From 797661a7c14830c2b9f92468c8f5568b2db3a891 Mon Sep 17 00:00:00 2001 From: polymorphicshade Date: Sat, 27 Jan 2024 13:37:51 -0700 Subject: [PATCH] some small changes/fixes related to PR (#5) --- .../org/schabi/newpipe/player/Player.java | 28 ++++++++++++------- app/src/main/res/layout/player.xml | 1 + app/src/main/res/values/settings_keys.xml | 4 +-- app/src/main/res/values/strings.xml | 6 ++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 4f3959161..4e9fb5ceb 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -954,16 +954,17 @@ public final class Player implements PlaybackListener, Listener { } public void triggerProgressUpdate() { - triggerProgressUpdate(false, false, false); + triggerProgressUpdate(false, false, false, false); } public void triggerProgressUpdate(final boolean isRewind) { - triggerProgressUpdate(isRewind, false, false); + triggerProgressUpdate(isRewind, false, false, false); } private void triggerProgressUpdate(final boolean isRewind, final boolean isGracedRewind, - final boolean bypassSecondaryMode) { + final boolean bypassSecondaryMode, + final boolean isUnSkip) { if (exoPlayerIsNull()) { return; } @@ -976,13 +977,14 @@ public final class Player implements PlaybackListener, Listener { simpleExoPlayer.getBufferedPercentage()); triggerCheckForSponsorBlockSegments(currentProgress, isRewind, - isGracedRewind, bypassSecondaryMode); + isGracedRewind, bypassSecondaryMode, isUnSkip); } private void triggerCheckForSponsorBlockSegments(final int currentProgress, final boolean isRewind, final boolean isGracedRewind, - final boolean bypassSecondaryMode) { + final boolean bypassSecondaryMode, + final boolean isUnSkip) { if (sponsorBlockMode != SponsorBlockMode.ENABLED || !isPrepared) { return; } @@ -1056,8 +1058,14 @@ public final class Player implements PlaybackListener, Listener { simpleExoPlayer.setSeekParameters(seekParams); lastSegment = sponsorBlockSegment; - if (prefs.getBoolean( - context.getString(R.string.sponsor_block_notifications_key), false)) { + if (isUnSkip) { + return; + } + + final boolean canShowNotifications = prefs.getBoolean( + context.getString(R.string.sponsor_block_notifications_key), false); + + if (canShowNotifications) { final String toastText = SponsorBlockHelper.convertCategoryToSkipMessage( context, sponsorBlockSegment.category); @@ -1355,12 +1363,12 @@ public final class Player implements PlaybackListener, Listener { } public void toggleUnskip() { - triggerProgressUpdate(true, true, true); + triggerProgressUpdate(true, true, true, true); } public void toggleSkip() { autoSkipGracePeriod = false; - triggerProgressUpdate(false, true, true); + triggerProgressUpdate(false, true, true, false); } //endregion @@ -1869,7 +1877,7 @@ public final class Player implements PlaybackListener, Listener { seekBy(-retrieveSeekDurationFromPreferences(this)); if (prefs.getBoolean( context.getString(R.string.sponsor_block_graced_rewind_key), false)) { - triggerProgressUpdate(true, true, false); + triggerProgressUpdate(true, true, false, false); return; } diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index 8a6a21e19..bad22dd1e 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -760,6 +760,7 @@ sponsor_block_category_pending_key sponsor_block_category_pending_color_key sponsor_block_clear_whitelist - sponsor_block_skip - sponsor_block_skip + sponsor_block_graced_rewind + sponsor_block_show_manual_skip @string/sponsor_block_skip_mode_enabled diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1bedcbe7a..523c01f63 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -934,11 +934,11 @@ Manual Highlight Only Rewind pauses skipping - Rewinding the video back into automatically skipped segments will pause segment skipping until the segment ends. + Rewinding the video back to automatically-skipped segments will pause skipping until the segment ends. Un-skip Skip - Shows Manual Buttons. - Shows buttons on-screen to manually skip/unskip segments. It is recommended to enable this when configuring SponsorBlock Categories to use Manual Skipping. + Show manual buttons + Show buttons on-screen to manually skip/unskip segments. Enabling this is recommended when configuring SponsorBlock Categories to be skipped manually. View Website View the official ReturnYouTubeDislike website.