Per-category skip modes & Unskip support (#5)

This commit is contained in:
Michael Zh 2024-01-27 15:22:02 -05:00 committed by GitHub
parent de131ee046
commit 2f8e863141
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 430 additions and 3 deletions

View file

@ -123,6 +123,7 @@ import org.schabi.newpipe.util.DependentPreferenceHelper;
import org.schabi.newpipe.util.ListHelper;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.SponsorBlockMode;
import org.schabi.newpipe.util.SponsorBlockSecondaryMode;
import org.schabi.newpipe.util.SponsorBlockHelper;
import org.schabi.newpipe.util.image.PicassoHelper;
import org.schabi.newpipe.util.SerializedCache;
@ -174,6 +175,7 @@ public final class Player implements PlaybackListener, Listener {
public static final int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds
public static final int PROGRESS_LOOP_INTERVAL_MILLIS = 1000; // 1 second
private static final int UNSKIP_WINDOW_MILLIS = 5000; // 5 seconds
/*//////////////////////////////////////////////////////////////////////////
// Other constants
@ -269,6 +271,8 @@ public final class Player implements PlaybackListener, Listener {
@NonNull
private final HistoryRecordManager recordManager;
private SponsorBlockMode sponsorBlockMode = SponsorBlockMode.DISABLED;
private SponsorBlockSegment lastSegment;
private boolean autoSkipGracePeriod = false;
private final SharedPreferences.OnSharedPreferenceChangeListener preferenceChangeListener;
@ -950,10 +954,16 @@ public final class Player implements PlaybackListener, Listener {
}
public void triggerProgressUpdate() {
triggerProgressUpdate(false);
triggerProgressUpdate(false, false, false);
}
public void triggerProgressUpdate(final boolean isRewind) {
triggerProgressUpdate(isRewind, false, false);
}
private void triggerProgressUpdate(final boolean isRewind,
final boolean isGracedRewind,
final boolean bypassSecondaryMode) {
if (exoPlayerIsNull()) {
return;
}
@ -965,16 +975,70 @@ public final class Player implements PlaybackListener, Listener {
(int) simpleExoPlayer.getDuration(),
simpleExoPlayer.getBufferedPercentage());
triggerCheckForSponsorBlockSegments(currentProgress, isRewind);
triggerCheckForSponsorBlockSegments(currentProgress, isRewind,
isGracedRewind, bypassSecondaryMode);
}
private void triggerCheckForSponsorBlockSegments(final int currentProgress,
final boolean isRewind) {
final boolean isRewind,
final boolean isGracedRewind,
final boolean bypassSecondaryMode) {
if (sponsorBlockMode != SponsorBlockMode.ENABLED || !isPrepared) {
return;
}
getSkippableSponsorBlockSegment(currentProgress).ifPresent(sponsorBlockSegment -> {
final boolean showManualButtons = prefs.getBoolean(
context.getString(R.string.sponsor_block_show_manual_skip_key), false);
// per-sponsorBlockSegment category skip setting
final SponsorBlockSecondaryMode secondaryMode = getSecondaryMode(sponsorBlockSegment);
// show/hide manual skip buttons
if (showManualButtons && secondaryMode != SponsorBlockSecondaryMode.HIGHLIGHT) {
if (currentProgress < sponsorBlockSegment.endTime
&& currentProgress > sponsorBlockSegment.startTime) {
UIs.call(PlayerUi::showAutoSkip);
} else {
UIs.call(PlayerUi::hideAutoSkip);
}
if (currentProgress > sponsorBlockSegment.startTime
&& currentProgress < sponsorBlockSegment.endTime + UNSKIP_WINDOW_MILLIS) {
UIs.call(PlayerUi::showAutoUnskip);
} else {
UIs.call(PlayerUi::hideAutoUnskip);
}
}
if (DEBUG) {
Log.d("SPONSOR_BLOCK", "Un-skip grace: isGracedRewind = "
+ isGracedRewind + ", autoSkipGracePeriod = " + autoSkipGracePeriod);
}
// temporarily pause auto skipping
// bypass grace when this is an un-skip request
if (!isGracedRewind) {
if (autoSkipGracePeriod) {
return;
}
} else {
autoSkipGracePeriod = true;
}
// prevent skip looping in unship window
if (lastSegment == sponsorBlockSegment && !bypassSecondaryMode) {
return;
}
// Do not skip if highlight mode. Do not skip if manual mode + no explicit bypass
if (secondaryMode == SponsorBlockSecondaryMode.HIGHLIGHT
|| (secondaryMode == SponsorBlockSecondaryMode.MANUAL
&& !bypassSecondaryMode)) {
return;
}
int skipTarget = isRewind
? (int) Math.ceil((sponsorBlockSegment.startTime)) - 1
: (int) Math.ceil((sponsorBlockSegment.endTime));
@ -990,6 +1054,7 @@ public final class Player implements PlaybackListener, Listener {
seekTo(skipTarget);
simpleExoPlayer.setSeekParameters(seekParams);
lastSegment = sponsorBlockSegment;
if (prefs.getBoolean(
context.getString(R.string.sponsor_block_notifications_key), false)) {
@ -1288,6 +1353,15 @@ public final class Player implements PlaybackListener, Listener {
simpleExoPlayer.setShuffleModeEnabled(!simpleExoPlayer.getShuffleModeEnabled());
}
}
public void toggleUnskip() {
triggerProgressUpdate(true, true, true);
}
public void toggleSkip() {
autoSkipGracePeriod = false;
triggerProgressUpdate(false, true, true);
}
//endregion
@ -1793,6 +1867,12 @@ public final class Player implements PlaybackListener, Listener {
Log.d(TAG, "fastRewind() called");
}
seekBy(-retrieveSeekDurationFromPreferences(this));
if (prefs.getBoolean(
context.getString(R.string.sponsor_block_graced_rewind_key), false)) {
triggerProgressUpdate(true, true, false);
return;
}
triggerProgressUpdate(true);
}
//endregion
@ -2409,10 +2489,86 @@ public final class Player implements PlaybackListener, Listener {
return sponsorBlockSegment;
}
// fallback on old SponsorBlockSegment (for un-skip)
if (lastSegment != null
&& progress > lastSegment.endTime + UNSKIP_WINDOW_MILLIS) {
// un-skip window is over
destroyUnskipVars();
} else if (lastSegment != null
&& progress < lastSegment.endTime + UNSKIP_WINDOW_MILLIS
&& progress >= lastSegment.startTime) {
// use old sponsorBlockSegment if exists AND currentProgress in bounds
return lastSegment;
}
destroyUnskipVars();
return null;
});
}
private void destroyUnskipVars() {
if (DEBUG) {
Log.d("SPONSOR_BLOCK", "Destroying last segment variables, hiding manual skip buttons");
}
lastSegment = null;
autoSkipGracePeriod = false;
UIs.call(PlayerUi::hideAutoSkip);
UIs.call(PlayerUi::hideAutoUnskip);
}
private SponsorBlockSecondaryMode getSecondaryMode(final SponsorBlockSegment segment) {
if (segment == null) {
return SponsorBlockSecondaryMode.DISABLED;
}
// get pref
final String defaultValue = context.getString(R.string.sponsor_block_skip_mode_enabled);
final String key = switch (segment.category) {
case SPONSOR -> prefs.getString(
context.getString(R.string.sponsor_block_category_sponsor_mode_key),
defaultValue);
case INTRO -> prefs.getString(
context.getString(R.string.sponsor_block_category_intro_mode_key),
defaultValue);
case OUTRO -> prefs.getString(
context.getString(R.string.sponsor_block_category_outro_mode_key),
defaultValue);
case INTERACTION -> prefs.getString(
context.getString(R.string.sponsor_block_category_interaction_mode_key),
defaultValue);
case HIGHLIGHT -> "Highlight Only"; // not a regular "skippable" segment
case SELF_PROMO -> prefs.getString(
context.getString(R.string.sponsor_block_category_self_promo_mode_key),
defaultValue);
case NON_MUSIC -> prefs.getString(
context.getString(R.string.sponsor_block_category_non_music_mode_key),
defaultValue);
case PREVIEW -> prefs.getString(
context.getString(R.string.sponsor_block_category_preview_mode_key),
defaultValue);
case FILLER -> prefs.getString(
context.getString(R.string.sponsor_block_category_filler_mode_key),
defaultValue);
default -> "";
};
// map pref to enum
final SponsorBlockSecondaryMode pref =
switch (key) {
case "Automatic" -> SponsorBlockSecondaryMode.ENABLED;
case "Manual" -> SponsorBlockSecondaryMode.MANUAL;
case "Highlight Only" -> SponsorBlockSecondaryMode.HIGHLIGHT;
default -> SponsorBlockSecondaryMode.DISABLED;
};
if (DEBUG) {
Log.d("SPONSOR_BLOCK", "Sponsor segment secondary mode: category = ["
+ segment.category + "], preference = [" + pref + "]");
}
return pref;
}
/**
* @return the user interfaces connected with the player
*/

View file

@ -212,4 +212,28 @@ public abstract class PlayerUi {
*/
public void onVideoSizeChanged(@NonNull final VideoSize videoSize) {
}
/**
* Show SponsorBlock segment un-skip button.
*/
public void showAutoUnskip() {
}
/**
* Hide SponsorBlock segment un-skip button.
*/
public void hideAutoUnskip() {
}
/**
* Show SponsorBlock segment skip button.
*/
public void showAutoSkip() {
}
/**
* Hide SponsorBlock segment skip button.
*/
public void hideAutoSkip() {
}
}

View file

@ -216,6 +216,8 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
binding.repeatButton.setOnClickListener(v -> onRepeatClicked());
binding.shuffleButton.setOnClickListener(v -> onShuffleClicked());
binding.unskipButton.setOnClickListener(v -> onUnskipClicked());
binding.skipButton.setOnClickListener(v -> onSkipClicked());
binding.playPauseButton.setOnClickListener(makeOnClickListener(player::playPause));
binding.playPreviousButton.setOnClickListener(makeOnClickListener(player::playPrevious));
@ -292,6 +294,8 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
binding.repeatButton.setOnClickListener(null);
binding.shuffleButton.setOnClickListener(null);
binding.unskipButton.setOnClickListener(null);
binding.skipButton.setOnClickListener(null);
binding.playPauseButton.setOnClickListener(null);
binding.playPreviousButton.setOnClickListener(null);
@ -857,6 +861,21 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
binding.getRoot().setKeepScreenOn(true);
}
public void showAutoUnskip() {
binding.unskipButton.setVisibility(View.VISIBLE);
}
public void hideAutoUnskip() {
binding.unskipButton.setVisibility(View.GONE);
}
public void showAutoSkip() {
binding.skipButton.setVisibility(View.VISIBLE);
}
public void hideAutoSkip() {
binding.skipButton.setVisibility(View.GONE);
}
@Override
public void onPaused() {
super.onPaused();
@ -953,6 +972,20 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
player.toggleShuffleModeEnabled();
}
public void onUnskipClicked() {
if (DEBUG) {
Log.d(TAG, "onUnskipClicked() called");
}
player.toggleUnskip();
}
public void onSkipClicked() {
if (DEBUG) {
Log.d(TAG, "onSkipClicked() called");
}
player.toggleSkip();
}
@Override
public void onRepeatModeChanged(@RepeatMode final int repeatMode) {
super.onRepeatModeChanged(repeatMode);

View file

@ -0,0 +1,8 @@
package org.schabi.newpipe.util;
public enum SponsorBlockSecondaryMode {
DISABLED,
ENABLED,
MANUAL,
HIGHLIGHT
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#64000000" />
<corners android:radius="5dp"/>
</shape>

View file

@ -758,6 +758,75 @@
tools:src="@drawable/ic_brightness_high" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/unskipButton"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:background="@drawable/background_rectangle_black_transparent"
android:padding="@dimen/player_main_buttons_padding">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/tooltipUnskipIcon"
android:src="@drawable/ic_previous"
android:clickable="false"
app:tint="@color/white"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitXY"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/tooltipUnskipText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sponsor_block_manual_unskip_button"
android:paddingRight="5dp"
android:layout_toRightOf="@+id/tooltipUnskipIcon"
android:layout_centerVertical="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="#FFFFFF" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/skipButton"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:background="@drawable/background_rectangle_black_transparent"
android:visibility="gone"
android:padding="@dimen/player_main_buttons_padding">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/tooltipSkipIcon"
android:src="@drawable/ic_next"
android:clickable="false"
app:tint="@color/white"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitXY"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_toRightOf="@+id/tooltipSkipText"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/tooltipSkipText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sponsor_block_manual_skip_button"
android:paddingLeft="5dp"
android:layout_centerVertical="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="#FFFFFF" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>

View file

@ -1478,26 +1478,42 @@
<string name="sponsor_block_category_all_on_key" translatable="false">sponsor_block_category_all_on</string>
<string name="sponsor_block_category_all_off_key" translatable="false">sponsor_block_category_all_off</string>
<string name="sponsor_block_category_sponsor_key" translatable="false">sponsor_block_category_sponsor</string>
<string name="sponsor_block_category_sponsor_mode_key" translatable="false">sponsor_block_category_sponsor_mode</string>
<string name="sponsor_block_category_sponsor_color_key" translatable="false">sponsor_block_category_sponsor_color</string>
<string name="sponsor_block_category_intro_key" translatable="false">sponsor_block_category_intro</string>
<string name="sponsor_block_category_intro_mode_key" translatable="false">sponsor_block_category_intro_mode</string>
<string name="sponsor_block_category_intro_color_key" translatable="false">sponsor_block_category_intro_color</string>
<string name="sponsor_block_category_outro_key" translatable="false">sponsor_block_category_outro</string>
<string name="sponsor_block_category_outro_mode_key" translatable="false">sponsor_block_category_outro_mode</string>
<string name="sponsor_block_category_outro_color_key" translatable="false">sponsor_block_category_outro_color</string>
<string name="sponsor_block_category_interaction_key" translatable="false">sponsor_block_category_interaction</string>
<string name="sponsor_block_category_interaction_mode_key" translatable="false">sponsor_block_category_interaction_mode</string>
<string name="sponsor_block_category_interaction_color_key" translatable="false">sponsor_block_category_interaction_color</string>
<string name="sponsor_block_category_highlight_key" translatable="false">sponsor_block_category_highlight</string>
<string name="sponsor_block_category_highlight_color_key" translatable="false">sponsor_block_category_highlight_color</string>
<string name="sponsor_block_category_self_promo_key" translatable="false">sponsor_block_category_self_promo</string>
<string name="sponsor_block_category_self_promo_mode_key" translatable="false">sponsor_block_category_promo_mode</string>
<string name="sponsor_block_category_self_promo_color_key" translatable="false">sponsor_block_category_self_promo_color</string>
<string name="sponsor_block_category_non_music_key" translatable="false">sponsor_block_category_music</string>
<string name="sponsor_block_category_non_music_mode_key" translatable="false">sponsor_block_category_music_mode</string>
<string name="sponsor_block_category_non_music_color_key" translatable="false">sponsor_block_category_music_color</string>
<string name="sponsor_block_category_preview_key" translatable="false">sponsor_block_category_preview</string>
<string name="sponsor_block_category_preview_mode_key" translatable="false">sponsor_block_category_preview_mode</string>
<string name="sponsor_block_category_preview_color_key" translatable="false">sponsor_block_category_preview_color</string>
<string name="sponsor_block_category_filler_key" translatable="false">sponsor_block_category_filler</string>
<string name="sponsor_block_category_filler_mode_key" translatable="false">sponsor_block_category_filler_mode</string>
<string name="sponsor_block_category_filler_color_key" translatable="false">sponsor_block_category_filler_color</string>
<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-array name="sponsor_block_category_sponsor_modes_key">
<item>@string/sponsor_block_skip_mode_enabled</item>
<item>@string/sponsor_block_skip_mode_manual</item>
<item>@string/sponsor_block_skip_mode_highlight</item>
</string-array>
<!-- ReturnYouTubeDislike -->
<string name="return_youtube_dislike_home_page_key" translatable="false">return_youtube_dislike_home_page</string>

View file

@ -910,6 +910,7 @@
<string name="settings_category_sponsor_block_categories_all_colors_on_title">All On</string>
<string name="settings_category_sponsor_block_categories_all_colors_off_title">All Off</string>
<string name="settings_category_sponsor_block_category_enable_title">Enable</string>
<string name="settings_category_sponsor_block_category_enable_mode_title">Skip Mode</string>
<string name="settings_category_sponsor_block_category_color">Seek Bar Color</string>
<string name="settings_category_sponsor_block_category_sponsor_summary">Paid promotion, paid referrals and direct advertisements. Not for self-promotion or free shoutouts to causes/creators/websites/products they like.</string>
<string name="settings_category_sponsor_block_category_intro_summary">An interval without actual content. Could be a pause, static frame, repeating animation. This should not be used for transitions containing information or be used on music videos.</string>
@ -929,6 +930,15 @@
<string name="description_up_vote_segment">Up-vote segment</string>
<string name="description_down_vote_segment">Down-vote segment</string>
<string name="description_skip_to_highlight">Skip to highlight</string>
<string name="sponsor_block_skip_mode_enabled">Automatic</string>
<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_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>
<!-- 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>

View file

@ -37,6 +37,17 @@
android:key="@string/sponsor_block_category_sponsor_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_sponsor_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_sponsor_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_sponsor_key"
@ -61,6 +72,17 @@
android:key="@string/sponsor_block_category_intro_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_intro_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_intro_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_intro_key"
@ -85,6 +107,17 @@
android:key="@string/sponsor_block_category_outro_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_outro_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_outro_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_outro_key"
@ -109,6 +142,17 @@
android:key="@string/sponsor_block_category_interaction_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_interaction_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_interaction_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_interaction_key"
@ -157,6 +201,17 @@
android:key="@string/sponsor_block_category_self_promo_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_self_promo_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_self_promo_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_self_promo_key"
@ -181,6 +236,17 @@
android:key="@string/sponsor_block_category_non_music_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_non_music_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_non_music_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_non_music_key"
@ -205,6 +271,17 @@
android:key="@string/sponsor_block_category_preview_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_preview_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_preview_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title" />
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_preview_key"
@ -229,6 +306,18 @@
android:key="@string/sponsor_block_category_filler_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<ListPreference
app:iconSpaceReserved="false"
app:singleLineTitle="false"
app:useSimpleSummaryProvider="true"
android:dependency="@string/sponsor_block_category_filler_key"
android:defaultValue="@string/sponsor_block_skip_mode_enabled"
android:entries="@array/sponsor_block_category_sponsor_modes_key"
android:entryValues="@array/sponsor_block_category_sponsor_modes_key"
android:key="@string/sponsor_block_category_filler_mode_key"
android:title="@string/settings_category_sponsor_block_category_enable_mode_title"
/>
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_filler_key"

View file

@ -34,6 +34,22 @@
android:summary="@string/sponsor_block_api_url_summary"
android:title="@string/sponsor_block_api_url_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_enable_key"
android:defaultValue="true"
android:key="@string/sponsor_block_show_manual_skip_key"
android:summary="@string/sponsor_block_show_manual_skip_summary"
android:title="@string/sponsor_block_show_manual_skip_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_enable_key"
android:defaultValue="true"
android:key="@string/sponsor_block_graced_rewind_key"
android:summary="@string/sponsor_block_graced_rewind_summary"
android:title="@string/sponsor_block_graced_rewind_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_enable_key"