diff --git a/app/src/main/java/org/schabi/newpipe/player/LocalPlayer.java b/app/src/main/java/org/schabi/newpipe/player/LocalPlayer.java index 57ea73671..2be37b295 100644 --- a/app/src/main/java/org/schabi/newpipe/player/LocalPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/LocalPlayer.java @@ -321,6 +321,9 @@ public class LocalPlayer implements com.google.android.exoplayer2.Player.Listene toastText = context .getString(R.string.sponsor_block_skip_non_music_toast); break; + case "preview": + toastText = context + .getString(R.string.sponsor_block_skip_preview_toast); case "filler": toastText = context .getString(R.string.sponsor_block_skip_filler_toast); 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 30e448f93..8e40ef7bf 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -1839,6 +1839,9 @@ public final class Player implements toastText = context .getString(R.string.sponsor_block_skip_non_music_toast); break; + case "preview": + toastText = context + .getString(R.string.sponsor_block_skip_preview_toast); case "filler": toastText = context .getString(R.string.sponsor_block_skip_filler_toast); diff --git a/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java index 0372ad2ff..af1ec6725 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java @@ -58,6 +58,10 @@ public class SponsorBlockCategoriesSettingsFragment extends BasePreferenceFragme R.string.sponsor_block_category_non_music_color_key, R.color.non_music_segment); + setColorPreference(editor, + R.string.sponsor_block_category_preview_color_key, + R.color.preview_segment); + setColorPreference(editor, R.string.sponsor_block_category_filler_color_key, R.color.filler_segment); diff --git a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java index f6e39166c..baad03fb8 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java @@ -71,6 +71,8 @@ public final class SponsorBlockUtils { .getString(R.string.sponsor_block_category_self_promo_key), false); final boolean includeMusicCategory = prefs.getBoolean(context .getString(R.string.sponsor_block_category_non_music_key), false); + final boolean includePreviewCategory = prefs.getBoolean(context + .getString(R.string.sponsor_block_category_preview_key), false); final boolean includeFillerCategory = prefs.getBoolean(context .getString(R.string.sponsor_block_category_filler_key), false); @@ -94,6 +96,9 @@ public final class SponsorBlockUtils { if (includeMusicCategory) { categoryParamList.add("music_offtopic"); } + if (includePreviewCategory) { + categoryParamList.add("preview"); + if (includeFillerCategory) { categoryParamList.add("filler"); } @@ -273,6 +278,14 @@ public final class SponsorBlockUtils { : Color.parseColor(colorStr); } break; + case "preview": + key = context.getString(R.string.sponsor_block_category_preview_key); + if (prefs.getBoolean(key, false)) { + key = context.getString(R.string.sponsor_block_category_preview_color_key); + colorStr = prefs.getString(key, null); + return colorStr == null + ? context.getResources().getColor(R.color.preview_segment) + : Color.parseColor(colorStr); case "filler": key = context.getString(R.string.sponsor_block_category_filler_key); if (prefs.getBoolean(key, false)) { diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 462c9c072..62e5d029f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -88,5 +88,6 @@ #cc00ff #ffff00 #ff9900 + #008fd6 #7300ff diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 9c4faed19..91376e575 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -428,6 +428,8 @@ sponsor_block_category_self_promo_color sponsor_block_category_music sponsor_block_category_music_color + sponsor_block_category_preview + sponsor_block_category_preview_color sponsor_block_category_filler sponsor_block_category_filler_color sponsor_block_whitelist diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 65fefe804..6e765cc9a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -163,6 +163,8 @@ Similar to "sponsor" except for unpaid or self promotion. This includes sections about merchandise, donations, or information about who they collaborated with. Music: Non-Music Section Only for use in music videos. This includes introductions or outros in music videos. + Preview/Recap + Quick recap of previous episodes, or a preview of what\'s coming up later in the current video. Meant for edited together clips, not for spoken summaries. Filler Tangent/Jokes This is for tangential scenes added only for filler or humor that are not required to understand the main content of the video. Playing in background @@ -794,6 +796,7 @@ Skipped interaction reminder Skipped unpaid/self promo Skipped non-music + Skipped preview/recap Skipped filler Toggle skipping sponsors Clear Whitelist diff --git a/app/src/main/res/xml/sponsor_block_category_settings.xml b/app/src/main/res/xml/sponsor_block_category_settings.xml index 78c1d6259..a3a9e325e 100644 --- a/app/src/main/res/xml/sponsor_block_category_settings.xml +++ b/app/src/main/res/xml/sponsor_block_category_settings.xml @@ -147,7 +147,31 @@ android:title="@string/settings_category_sponsor_block_category_color"/> + + + + + + + + + +