some small changes/fixes related to PR (#5)

This commit is contained in:
polymorphicshade 2024-01-27 13:37:51 -07:00
parent 2f8e863141
commit 797661a7c1
4 changed files with 24 additions and 15 deletions

View file

@ -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;
}

View file

@ -760,6 +760,7 @@
<RelativeLayout
android:id="@+id/unskipButton"
android:visibility="gone"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -1506,8 +1506,8 @@
<string name="sponsor_block_category_pending_key" translatable="false">sponsor_block_category_pending_key</string>
<string name="sponsor_block_category_pending_color_key" translatable="false">sponsor_block_category_pending_color_key</string>
<string name="sponsor_block_clear_whitelist_key" translatable="false">sponsor_block_clear_whitelist</string>
<string name="sponsor_block_graced_rewind_key" translatable="false">sponsor_block_skip</string>
<string name="sponsor_block_show_manual_skip_key" translatable="false">sponsor_block_skip</string>
<string name="sponsor_block_graced_rewind_key" translatable="false">sponsor_block_graced_rewind</string>
<string name="sponsor_block_show_manual_skip_key" translatable="false">sponsor_block_show_manual_skip</string>
<string-array name="sponsor_block_category_sponsor_modes_key">
<item>@string/sponsor_block_skip_mode_enabled</item>

View file

@ -934,11 +934,11 @@
<string name="sponsor_block_skip_mode_manual">Manual</string>
<string name="sponsor_block_skip_mode_highlight">Highlight Only</string>
<string name="sponsor_block_graced_rewind_title">Rewind pauses skipping</string>
<string name="sponsor_block_graced_rewind_summary">Rewinding the video back into automatically skipped segments will pause segment skipping until the segment ends.</string>
<string name="sponsor_block_graced_rewind_summary">Rewinding the video back to automatically-skipped segments will pause skipping until the segment ends.</string>
<string name="sponsor_block_manual_unskip_button">Un-skip</string>
<string name="sponsor_block_manual_skip_button">Skip</string>
<string name="sponsor_block_show_manual_skip_title">Shows Manual Buttons.</string>
<string name="sponsor_block_show_manual_skip_summary">Shows buttons on-screen to manually skip/unskip segments. It is recommended to enable this when configuring SponsorBlock Categories to use Manual Skipping.</string>
<string name="sponsor_block_show_manual_skip_title">Show manual buttons</string>
<string name="sponsor_block_show_manual_skip_summary">Show buttons on-screen to manually skip/unskip segments. Enabling this is recommended when configuring SponsorBlock Categories to be skipped manually.</string>
<!-- ReturnYouTubeDislike -->
<string name="return_youtube_dislike_home_page_title">View Website</string>
<string name="return_youtube_dislike_home_page_summary">View the official ReturnYouTubeDislike website.</string>