Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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;
Expand All @@ -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));

Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/org/schabi/newpipe/util/SponsorBlockHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<color name="self_promo_segment">#ffff00</color>
<color name="non_music_segment">#ff9900</color>
<color name="preview_segment">#008fd6</color>
<color name="hook_segment">#395699</color>
<color name="filler_segment">#7300ff</color>
<color name="pending_segment">#ffffff</color>

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
<item>5</item>
<item>10</item>
</string-array>

<string name="middle_gesture_area_width_key">middle_gesture_area_width</string>
<string name="default_middle_gesture_area_width_value">.3333</string>
<string-array name="middle_gesture_area_width_description_list">
Expand Down Expand Up @@ -1594,6 +1594,9 @@
<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_hook_key" translatable="false">sponsor_block_category_hook</string>
<string name="sponsor_block_category_hook_mode_key" translatable="false">sponsor_block_category_hook_mode</string>
<string name="sponsor_block_category_hook_color_key" translatable="false">sponsor_block_category_hook_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>
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,8 @@
<string name="sponsor_block_category_self_promo">Unpaid/Self Promotion</string>
<string name="sponsor_block_category_non_music">Music: Non-Music Section</string>
<string name="sponsor_block_category_preview">Preview/Recap</string>
<string name="sponsor_block_category_filler">Filler Tangent/Jokes</string>
<string name="sponsor_block_category_hook">Hook/Greetings</string>
<string name="sponsor_block_category_filler">Tangent/Jokes</string>
<string name="sponsor_block_category_pending">Pending</string>
<string name="sponsor_block_home_page_title">View Website</string>
<string name="sponsor_block_home_page_summary">View the official SponsorBlock website.</string>
Expand All @@ -916,6 +917,7 @@
<string name="sponsor_block_skip_self_promo_toast">Skipped unpaid/self promo</string>
<string name="sponsor_block_skip_non_music_toast">Skipped non-music</string>
<string name="sponsor_block_skip_preview_toast">Skipped preview/recap</string>
<string name="sponsor_block_skip_hook_toast">Skipped hook</string>
<string name="sponsor_block_skip_filler_toast">Skipped filler</string>
<string name="sponsor_block_skip_pending_toast">Skipped pending segment</string>
<string name="sponsor_block_toggle_skipping">Toggle skipping sponsors</string>
Expand Down Expand Up @@ -963,6 +965,7 @@
<string name="settings_category_sponsor_block_category_self_promo_summary">Similar to "sponsor" except for unpaid or self promotion. This includes sections about merchandise, donations, or information about who they collaborated with.</string>
<string name="settings_category_sponsor_block_category_non_music_summary">Only for use in music videos. This includes introductions or outros in music videos.</string>
<string name="settings_category_sponsor_block_category_preview_summary">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.</string>
<string name="settings_category_sponsor_block_category_hook_summary">For narrative hooks that tease upcoming moments in a video, plus dedicated greetings and goodbyes.</string>
<string name="settings_category_sponsor_block_category_filler_summary">This is for tangential scenes added only for filler or humor that are not required to understand the main content of the video.</string>
<string name="settings_category_sponsor_block_category_pending_summary">Represents a new segment ready to be submitted.</string>
<string name="submit">Submit</string>
Expand Down
38 changes: 37 additions & 1 deletion app/src/main/res/xml/sponsor_block_category_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,42 @@

</PreferenceCategory>

<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/sponsor_block_category_hook">

<Preference
app:iconSpaceReserved="false"
android:summary="@string/settings_category_sponsor_block_category_hook_summary"
android:selectable="false"/>

<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/sponsor_block_category_hook_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_hook_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_hook_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_hook_key"
android:defaultValue="@color/hook_segment"
android:key="@string/sponsor_block_category_hook_color_key"
android:title="@string/settings_category_sponsor_block_category_color"/>

</PreferenceCategory>

<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/sponsor_block_category_filler">
Expand Down Expand Up @@ -343,4 +379,4 @@
android:title="@string/settings_category_sponsor_block_category_color"/>

</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>
Loading