Merge pull request #150 from slaytostay/preview-category
Implement Preview/Recap Category
This commit is contained in:
commit
a4b9c8f19b
8 changed files with 53 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -88,5 +88,6 @@
|
|||
<color name="interaction_segment">#cc00ff</color>
|
||||
<color name="self_promo_segment">#ffff00</color>
|
||||
<color name="non_music_segment">#ff9900</color>
|
||||
<color name="preview_segment">#008fd6</color>
|
||||
<color name="filler_segment">#7300ff</color>
|
||||
</resources>
|
||||
|
|
|
@ -428,6 +428,8 @@
|
|||
<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_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_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_color_key" translatable="false">sponsor_block_category_filler_color</string>
|
||||
<string name="sponsor_block_whitelist_key" translatable="false">sponsor_block_whitelist</string>
|
||||
|
|
|
@ -163,6 +163,8 @@
|
|||
<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_title">Music: Non-Music Section</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_title">Preview/Recap</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_filler_title">Filler Tangent/Jokes</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="background_player_playing_toast">Playing in background</string>
|
||||
|
@ -794,6 +796,7 @@
|
|||
<string name="sponsor_block_skip_interaction_toast">Skipped interaction reminder</string>
|
||||
<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_filler_toast">Skipped filler</string>
|
||||
<string name="sponsor_block_toggle_skipping">Toggle skipping sponsors</string>
|
||||
<string name="sponsor_block_clear_whitelist_title">Clear Whitelist</string>
|
||||
|
|
|
@ -147,7 +147,31 @@
|
|||
android:title="@string/settings_category_sponsor_block_category_color"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:layout="@layout/settings_category_header_layout"
|
||||
android:title="@string/settings_category_sponsor_block_category_preview_title">
|
||||
|
||||
<Preference
|
||||
app:iconSpaceReserved="false"
|
||||
android:summary="@string/settings_category_sponsor_block_category_preview_summary"
|
||||
android:selectable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
app:iconSpaceReserved="false"
|
||||
android:defaultValue="false"
|
||||
android:key="@string/sponsor_block_category_preview_key"
|
||||
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
|
||||
|
||||
<org.schabi.newpipe.settings.custom.EditColorPreference
|
||||
app:iconSpaceReserved="false"
|
||||
android:dependency="@string/sponsor_block_category_preview_key"
|
||||
android:defaultValue="@color/preview_segment"
|
||||
android:key="@string/sponsor_block_category_preview_color_key"
|
||||
android:title="@string/settings_category_sponsor_block_category_color"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:layout="@layout/settings_category_header_layout"
|
||||
android:title="@string/settings_category_sponsor_block_category_filler_title">
|
||||
|
|
Loading…
Reference in a new issue