diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/sponsorblock/SponsorBlockFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/sponsorblock/SponsorBlockFragment.java index c4aaba710..9962189be 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/sponsorblock/SponsorBlockFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/sponsorblock/SponsorBlockFragment.java @@ -330,6 +330,8 @@ private void doSubmitPendingSegment() { context, SponsorBlockCategory.NON_MUSIC), SponsorBlockHelper.convertCategoryToFriendlyName( context, SponsorBlockCategory.PREVIEW), + SponsorBlockHelper.convertCategoryToFriendlyName( + context, SponsorBlockCategory.HOOK), SponsorBlockHelper.convertCategoryToFriendlyName( context, SponsorBlockCategory.FILLER) }, (dialog, which) -> { 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 5d01dfdcd..25af24d0d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -2622,6 +2622,9 @@ private SponsorBlockSecondaryMode getSecondaryMode(final SponsorBlockSegment seg case PREVIEW -> prefs.getString( context.getString(R.string.sponsor_block_category_preview_mode_key), defaultValue); + case HOOK -> prefs.getString( + context.getString(R.string.sponsor_block_category_hook_mode_key), + defaultValue); case FILLER -> prefs.getString( context.getString(R.string.sponsor_block_category_filler_mode_key), defaultValue); 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 20cd7ceb4..de5348feb 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SponsorBlockCategoriesSettingsFragment.java @@ -42,6 +42,8 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro findPreference(getString(R.string.sponsor_block_category_non_music_key)); final SwitchPreference previewCategoryPreference = findPreference(getString(R.string.sponsor_block_category_preview_key)); + final SwitchPreference hookCategoryPreference = + findPreference(getString(R.string.sponsor_block_category_hook_key)); final SwitchPreference fillerCategoryPreference = findPreference(getString(R.string.sponsor_block_category_filler_key)); @@ -53,6 +55,7 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro selfPromoCategoryPreference.setChecked(true); nonMusicCategoryPreference.setChecked(true); previewCategoryPreference.setChecked(true); + hookCategoryPreference.setChecked(true); fillerCategoryPreference.setChecked(true); return true; @@ -77,6 +80,8 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro findPreference(getString(R.string.sponsor_block_category_non_music_key)); final SwitchPreference previewCategoryPreference = findPreference(getString(R.string.sponsor_block_category_preview_key)); + final SwitchPreference hookCategoryPreference = + findPreference(getString(R.string.sponsor_block_category_hook_key)); final SwitchPreference fillerCategoryPreference = findPreference(getString(R.string.sponsor_block_category_filler_key)); @@ -88,6 +93,7 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro selfPromoCategoryPreference.setChecked(false); nonMusicCategoryPreference.setChecked(false); previewCategoryPreference.setChecked(false); + hookCategoryPreference.setChecked(false); fillerCategoryPreference.setChecked(false); return true; @@ -128,6 +134,9 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro setColorPreference(editor, R.string.sponsor_block_category_preview_color_key, R.color.preview_segment); + setColorPreference(editor, + R.string.sponsor_block_category_hook_color_key, + R.color.hook_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/ExtractorHelper.java b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java index 0d1162221..e91602c5f 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java @@ -423,6 +423,9 @@ private static String capitalizeIfAllUppercase(final String text) { result.includePreviewCategory = prefs.getBoolean(context .getString(R.string.sponsor_block_category_preview_key), false); + result.includeHookCategory = + prefs.getBoolean(context + .getString(R.string.sponsor_block_category_hook_key), false); result.includeFillerCategory = prefs.getBoolean(context .getString(R.string.sponsor_block_category_filler_key), false); diff --git a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockHelper.java b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockHelper.java index 77b7ebf68..643d2c88d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockHelper.java @@ -84,6 +84,13 @@ public static Integer convertCategoryToColor( ? context.getResources().getColor(R.color.preview_segment) : Color.parseColor(colorStr); } + case HOOK -> { + key = context.getString(R.string.sponsor_block_category_hook_color_key); + colorStr = prefs.getString(key, null); + return colorStr == null + ? context.getResources().getColor(R.color.hook_segment) + : Color.parseColor(colorStr); + } case FILLER -> { key = context.getString(R.string.sponsor_block_category_filler_color_key); colorStr = prefs.getString(key, null); @@ -156,6 +163,8 @@ public static String convertCategoryToFriendlyName(final Context context, R.string.sponsor_block_category_non_music); case PREVIEW -> context.getString( R.string.sponsor_block_category_preview); + case HOOK -> context.getString( + R.string.sponsor_block_category_hook); case FILLER -> context.getString( R.string.sponsor_block_category_filler); case PENDING -> context.getString( @@ -181,6 +190,8 @@ public static String convertCategoryToSkipMessage(final Context context, .getString(R.string.sponsor_block_skip_non_music_toast); case PREVIEW -> context .getString(R.string.sponsor_block_skip_preview_toast); + case HOOK -> context + .getString(R.string.sponsor_block_skip_hook_toast); case FILLER -> context .getString(R.string.sponsor_block_skip_filler_toast); case PENDING -> context diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index cc9aa955d..1d3465893 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -93,6 +93,7 @@ #ffff00 #ff9900 #008fd6 + #395699 #7300ff #ffffff diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index db69deadd..8319d1018 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -265,7 +265,7 @@ 5 10 - + middle_gesture_area_width .3333 @@ -1594,6 +1594,9 @@ sponsor_block_category_preview sponsor_block_category_preview_mode sponsor_block_category_preview_color + sponsor_block_category_hook + sponsor_block_category_hook_mode + sponsor_block_category_hook_color sponsor_block_category_filler sponsor_block_category_filler_mode sponsor_block_category_filler_color diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 699d8e6d7..fc231ed19 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -892,7 +892,8 @@ Unpaid/Self Promotion Music: Non-Music Section Preview/Recap - Filler Tangent/Jokes + Hook/Greetings + Tangent/Jokes Pending View Website View the official SponsorBlock website. @@ -916,6 +917,7 @@ Skipped unpaid/self promo Skipped non-music Skipped preview/recap + Skipped hook Skipped filler Skipped pending segment Toggle skipping sponsors @@ -963,6 +965,7 @@ Similar to "sponsor" except for unpaid or self promotion. This includes sections about merchandise, donations, or information about who they collaborated with. Only for use in music videos. This includes introductions or outros in music videos. 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. + For narrative hooks that tease upcoming moments in a video, plus dedicated greetings and goodbyes. This is for tangential scenes added only for filler or humor that are not required to understand the main content of the video. Represents a new segment ready to be submitted. Submit 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 e9e2fb60f..5a8529b17 100644 --- a/app/src/main/res/xml/sponsor_block_category_settings.xml +++ b/app/src/main/res/xml/sponsor_block_category_settings.xml @@ -291,6 +291,42 @@ + + + + + + + + + + + + @@ -343,4 +379,4 @@ android:title="@string/settings_category_sponsor_block_category_color"/> - \ No newline at end of file +