SponsorBlock: Refactored SponsorBlock settings

Also added an experimental setting to disable tablet UI.
This commit is contained in:
polymorphicshade 2020-12-15 00:06:22 -07:00
parent 53f9e6b0a8
commit 63eb637ec0
13 changed files with 315 additions and 191 deletions

View file

@ -47,6 +47,18 @@
android:title="@string/settings_category_updates_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.SponsorBlockSettingsFragment"
android:icon="?attr/ic_sponsor_block_enable"
android:title="@string/sponsor_block"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.ExtraSettingsFragment"
android:icon="?attr/ic_asterisk"
android:title="@string/extras"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.DebugSettingsFragment"
android:icon="?attr/ic_bug_report"

View file

@ -5,10 +5,8 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -41,7 +39,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.zip.ZipFile;
@ -161,59 +158,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
startActivityForResult(i, REQUEST_EXPORT_PATH);
return true;
});
final Preference sponsorBlockWebsitePreference =
findPreference(getString(R.string.sponsor_block_home_page_key));
sponsorBlockWebsitePreference.setOnPreferenceClickListener((Preference p) -> {
final Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.sponsor_block_homepage_url)));
startActivity(i);
return true;
});
final Preference sponsorBlockPrivacyPreference =
findPreference(getString(R.string.sponsor_block_privacy_key));
sponsorBlockPrivacyPreference.setOnPreferenceClickListener((Preference p) -> {
final Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.sponsor_block_privacy_policy_url)));
startActivity(i);
return true;
});
final Preference sponsorBlockApiUrlPreference =
findPreference(getString(R.string.sponsor_block_api_url_key));
sponsorBlockApiUrlPreference
.setOnPreferenceChangeListener((preference, newValue) -> {
updateDependencies(preference, newValue);
return true;
});
final Preference sponsorBlockClearWhitelistPreference =
findPreference(getString(R.string.sponsor_block_clear_whitelist_key));
sponsorBlockClearWhitelistPreference.setOnPreferenceClickListener((Preference p) -> {
getPreferenceManager()
.getSharedPreferences()
.edit()
.putStringSet(
getString(R.string.sponsor_block_whitelist_key), new HashSet<>())
.apply();
Toast.makeText(getContext(), R.string.sponsor_block_whitelist_cleared_toast,
Toast.LENGTH_SHORT).show();
return true;
});
}
@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final Preference sponsorBlockApiUrlPreference =
findPreference(getString(R.string.sponsor_block_api_url_key));
final String sponsorBlockApiUrlPreferenceValue =
getPreferenceManager()
.getSharedPreferences()
.getString(getString(R.string.sponsor_block_api_url_key), null);
updateDependencies(sponsorBlockApiUrlPreference, sponsorBlockApiUrlPreferenceValue);
}
@Override
@ -381,26 +325,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
}
}
private void updateDependencies(final Preference preference, final Object newValue) {
// This is a workaround to force dependency updates for custom preferences.
// sponsor_block_api_url_key
if (preference.getKey().equals(getString(R.string.sponsor_block_api_url_key))) {
findPreference(getString(R.string.sponsor_block_enable_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_notifications_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_categories_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_clear_whitelist_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
}
}
/*//////////////////////////////////////////////////////////////////////////
// Error
//////////////////////////////////////////////////////////////////////////*/

View file

@ -0,0 +1,12 @@
package org.schabi.newpipe.settings;
import android.os.Bundle;
import org.schabi.newpipe.R;
public class ExtraSettingsFragment extends BasePreferenceFragment {
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.extra_settings);
}
}

View file

@ -1,12 +1,13 @@
package org.schabi.newpipe.settings;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.Toast;
import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import org.schabi.newpipe.R;
@ -22,48 +23,52 @@ public class SponsorBlockCategoriesSettingsFragment extends BasePreferenceFragme
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.sponsor_block_category_settings);
final Preference resetPreferenceView =
final Preference resetPreference =
findPreference(getString(R.string.sponsor_block_category_reset_key));
if (resetPreferenceView != null) {
resetPreferenceView.setOnPreferenceClickListener(preference -> {
final Context context = getContext();
resetPreference.setOnPreferenceClickListener(p -> {
new AlertDialog.Builder(p.getContext())
.setMessage(R.string.sponsor_block_confirm_reset_colors)
.setPositiveButton(R.string.yes, (dialog, which) -> {
final SharedPreferences.Editor editor =
getPreferenceManager()
.getSharedPreferences()
.edit();
if (context != null) {
final SharedPreferences.Editor editor =
getPreferenceManager()
.getSharedPreferences()
.edit();
setColorPreference(editor,
R.string.sponsor_block_category_sponsor_color_key,
R.color.sponsor_segment);
setColorPreference(editor,
R.string.sponsor_block_category_sponsor_color_key,
R.color.sponsor_segment);
setColorPreference(editor,
R.string.sponsor_block_category_intro_color_key,
R.color.intro_segment);
setColorPreference(editor,
R.string.sponsor_block_category_intro_color_key,
R.color.intro_segment);
setColorPreference(editor,
R.string.sponsor_block_category_outro_color_key,
R.color.outro_segment);
setColorPreference(editor,
R.string.sponsor_block_category_outro_color_key,
R.color.outro_segment);
setColorPreference(editor,
R.string.sponsor_block_category_interaction_color_key,
R.color.interaction_segment);
setColorPreference(editor,
R.string.sponsor_block_category_interaction_color_key,
R.color.interaction_segment);
setColorPreference(editor,
R.string.sponsor_block_category_self_promo_color_key,
R.color.self_promo_segment);
setColorPreference(editor,
R.string.sponsor_block_category_self_promo_color_key,
R.color.self_promo_segment);
setColorPreference(editor,
R.string.sponsor_block_category_non_music_color_key,
R.color.non_music_segment);
setColorPreference(editor,
R.string.sponsor_block_category_non_music_color_key,
R.color.non_music_segment);
editor.apply();
editor.apply();
}
return true;
});
}
Toast.makeText(p.getContext(), R.string.sponsor_block_reset_colors_toast,
Toast.LENGTH_SHORT).show();
})
.setNegativeButton(R.string.no, (dialog, which) -> {
dialog.dismiss();
})
.show();
return true;
});
}
private void setColorPreference(final SharedPreferences.Editor editor,

View file

@ -0,0 +1,106 @@
package org.schabi.newpipe.settings;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import org.schabi.newpipe.R;
import java.util.HashSet;
public class SponsorBlockSettingsFragment extends BasePreferenceFragment {
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.sponsor_block_settings);
final Preference sponsorBlockWebsitePreference =
findPreference(getString(R.string.sponsor_block_home_page_key));
sponsorBlockWebsitePreference.setOnPreferenceClickListener((Preference p) -> {
final Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.sponsor_block_homepage_url)));
startActivity(i);
return true;
});
final Preference sponsorBlockPrivacyPreference =
findPreference(getString(R.string.sponsor_block_privacy_key));
sponsorBlockPrivacyPreference.setOnPreferenceClickListener((Preference p) -> {
final Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.sponsor_block_privacy_policy_url)));
startActivity(i);
return true;
});
final Preference sponsorBlockApiUrlPreference =
findPreference(getString(R.string.sponsor_block_api_url_key));
sponsorBlockApiUrlPreference
.setOnPreferenceChangeListener((preference, newValue) -> {
updateDependencies(preference, newValue);
return true;
});
final Preference sponsorBlockClearWhitelistPreference =
findPreference(getString(R.string.sponsor_block_clear_whitelist_key));
sponsorBlockClearWhitelistPreference.setOnPreferenceClickListener((Preference p) -> {
new AlertDialog.Builder(p.getContext())
.setMessage(R.string.sponsor_block_confirm_clear_whitelist)
.setPositiveButton(R.string.yes, (dialog, which) -> {
getPreferenceManager()
.getSharedPreferences()
.edit()
.putStringSet(getString(
R.string.sponsor_block_whitelist_key), new HashSet<>())
.apply();
Toast.makeText(p.getContext(),
R.string.sponsor_block_whitelist_cleared_toast,
Toast.LENGTH_SHORT).show();
})
.setNegativeButton(R.string.no, (dialog, which) -> {
dialog.dismiss();
})
.show();
return true;
});
}
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final Preference sponsorBlockApiUrlPreference =
findPreference(getString(R.string.sponsor_block_api_url_key));
final String sponsorBlockApiUrlPreferenceValue =
getPreferenceManager()
.getSharedPreferences()
.getString(getString(R.string.sponsor_block_api_url_key), null);
updateDependencies(sponsorBlockApiUrlPreference, sponsorBlockApiUrlPreferenceValue);
}
private void updateDependencies(final Preference preference, final Object newValue) {
// This is a workaround to force dependency updates for custom preferences.
// sponsor_block_api_url_key
if (preference.getKey().equals(getString(R.string.sponsor_block_api_url_key))) {
findPreference(getString(R.string.sponsor_block_enable_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_notifications_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_categories_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
findPreference(getString(R.string.sponsor_block_clear_whitelist_key))
.onDependencyChanged(preference,
newValue == null || newValue.equals(""));
}
}
}

View file

@ -2,6 +2,7 @@ package org.schabi.newpipe.util;
import android.app.UiModeManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.BatteryManager;
@ -10,8 +11,10 @@ import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceManager;
import org.schabi.newpipe.App;
import org.schabi.newpipe.R;
public final class DeviceUtils {
@ -53,6 +56,13 @@ public final class DeviceUtils {
}
public static boolean isTablet(@NonNull final Context context) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context
.getString(R.string.disable_tablet_ui_key), false)) {
return false;
}
return (context
.getResources()
.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)

View file

@ -266,28 +266,6 @@
<string name="downloads_storage_ask" translatable="false">downloads_storage_ask</string>
<string name="storage_use_saf" translatable="false">storage_use_saf</string>
<string name="sponsor_block_home_page_key" translatable="false">sponsor_block_home_page</string>
<string name="sponsor_block_enable_key" translatable="false">sponsor_block_enable</string>
<string name="sponsor_block_api_url_key" translatable="false">sponsor_block_api_url</string>
<string name="sponsor_block_notifications_key" translatable="false">sponsor_block_notifications</string>
<string name="sponsor_block_privacy_key" translatable="false">sponsor_block_privacy</string>
<string name="sponsor_block_categories_key" translatable="false">sponsor_block_categories</string>
<string name="sponsor_block_category_reset_key" translatable="false">sponsor_block_category_reset</string>
<string name="sponsor_block_category_sponsor_key" translatable="false">sponsor_block_category_sponsor</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_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_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_color_key" translatable="false">sponsor_block_category_interaction_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_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_whitelist_key" translatable="false">sponsor_block_whitelist</string>
<string name="sponsor_block_clear_whitelist_key" translatable="false">sponsor_block_clear_whitelist</string>
<!-- FileName Downloads -->
<string name="settings_file_charset_key" translatable="false">file_rename_charset</string>
<string name="settings_file_replacement_character_key" translatable="false">file_replacement_character</string>
@ -361,6 +339,32 @@
<string name="update_app_key" translatable="false">update_app_key</string>
<string name="update_pref_screen_key" translatable="false">update_pref_screen_key</string>
<!-- SponsorBlock -->
<string name="sponsor_block_home_page_key" translatable="false">sponsor_block_home_page</string>
<string name="sponsor_block_enable_key" translatable="false">sponsor_block_enable</string>
<string name="sponsor_block_api_url_key" translatable="false">sponsor_block_api_url</string>
<string name="sponsor_block_notifications_key" translatable="false">sponsor_block_notifications</string>
<string name="sponsor_block_privacy_key" translatable="false">sponsor_block_privacy</string>
<string name="sponsor_block_categories_key" translatable="false">sponsor_block_categories</string>
<string name="sponsor_block_category_reset_key" translatable="false">sponsor_block_category_reset</string>
<string name="sponsor_block_category_sponsor_key" translatable="false">sponsor_block_category_sponsor</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_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_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_color_key" translatable="false">sponsor_block_category_interaction_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_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_whitelist_key" translatable="false">sponsor_block_whitelist</string>
<string name="sponsor_block_clear_whitelist_key" translatable="false">sponsor_block_clear_whitelist</string>
<!-- Extras -->
<string name="disable_tablet_ui_key" translatable="false">disable_tablet_ui</string>
<!-- Localizations -->
<string name="default_localization_key" translatable="false">system</string>
<!-- alternatively, load these from some local android data store -->

View file

@ -194,6 +194,7 @@
<string name="albums">Albums</string>
<string name="artists">Artists</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="later">Later</string>
<string name="disabled">Disabled</string>
<string name="filter">Filter</string>
@ -705,6 +706,8 @@
<string name="show_thumbnail_title">Show thumbnail</string>
<string name="show_thumbnail_summary">Show thumbnail on lock screen as background and inside notifications</string>
<!-- SponsorBlock -->
<string name="sponsor_block">SponsorBlock</string>
<string name="sponsor_block_information">Information</string>
<string name="sponsor_block_home_page_title">View Website</string>
<string name="sponsor_block_home_page_summary">View the official SponsorBlock website.</string>
<string name="sponsor_block_enable_title">Skip Sponsors</string>
@ -734,4 +737,12 @@
<string name="sponsor_block_whitelist_cleared_toast">Whitelist cleared</string>
<string name="sponsor_block_uploader_added_to_whitelist_toast">Uploader added to whitelist</string>
<string name="sponsor_block_uploader_removed_from_whitelist_toast">Uploader removed from whitelist</string>
<string name="sponsor_block_confirm_clear_whitelist">Are you sure you want to clear the whitelist?</string>
<string name="sponsor_block_confirm_reset_colors">Are you sure you want to reset the category colors?</string>
<string name="sponsor_block_reset_colors_toast">Colors reset.</string>
<!-- Extras -->
<string name="extras">Extras</string>
<string name="experimental_settings">Experimental Settings</string>
<string name="disable_tablet_ui_title">Disable Tablet UI</string>
<string name="disable_tablet_ui_summary">Ignore tablet layouts. This is intended for workarounds related to specific scenarios.</string>
</resources>

View file

@ -125,58 +125,4 @@
app:iconSpaceReserved="false" />
</PreferenceCategory>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/settings_category_sponsor_block_title">
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_home_page_key"
android:summary="@string/sponsor_block_home_page_summary"
android:title="@string/sponsor_block_home_page_title"/>
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_privacy_key"
android:summary="@string/sponsor_block_privacy_summary"
android:title="@string/sponsor_block_privacy_title"/>
<org.schabi.newpipe.settings.custom.SponsorBlockApiUrlPreference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_api_url_key"
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_api_url_key"
android:defaultValue="false"
android:key="@string/sponsor_block_enable_key"
android:summary="@string/sponsor_block_enable_summary"
android:title="@string/sponsor_block_enable_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:dependency="@string/sponsor_block_api_url_key"
android:key="@string/sponsor_block_notifications_key"
android:summary="@string/sponsor_block_notifications_summary"
android:title="@string/sponsor_block_notifications_title"/>
<PreferenceScreen
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_api_url_key"
android:fragment="org.schabi.newpipe.settings.SponsorBlockCategoriesSettingsFragment"
android:key="@string/sponsor_block_categories_key"
android:title="@string/settings_category_sponsor_block_categories_title"
android:summary="@string/settings_category_sponsor_block_categories_summary"/>
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_clear_whitelist_key"
android:summary="@string/sponsor_block_clear_whitelist_summary"
android:title="@string/sponsor_block_clear_whitelist_title"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/extras">
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/experimental_settings">
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="false"
android:key="@string/disable_tablet_ui_key"
android:summary="@string/disable_tablet_ui_summary"
android:title="@string/disable_tablet_ui_title"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -4,11 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/settings_category_sponsor_block_categories_title">
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_category_reset_key"
android:title="@string/settings_category_sponsor_block_categories_reset_colors_title"/>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/settings_category_sponsor_block_category_sponsor_title">
@ -153,4 +148,12 @@
</PreferenceCategory>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout">
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_category_reset_key"
android:title="@string/settings_category_sponsor_block_categories_reset_colors_title"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/sponsor_block">
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/sponsor_block_information">
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_home_page_key"
android:summary="@string/sponsor_block_home_page_summary"
android:title="@string/sponsor_block_home_page_title"/>
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_privacy_key"
android:summary="@string/sponsor_block_privacy_summary"
android:title="@string/sponsor_block_privacy_title"/>
</PreferenceCategory>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/settings">
<org.schabi.newpipe.settings.custom.SponsorBlockApiUrlPreference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_api_url_key"
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_api_url_key"
android:defaultValue="false"
android:key="@string/sponsor_block_enable_key"
android:summary="@string/sponsor_block_enable_summary"
android:title="@string/sponsor_block_enable_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:dependency="@string/sponsor_block_api_url_key"
android:key="@string/sponsor_block_notifications_key"
android:summary="@string/sponsor_block_notifications_summary"
android:title="@string/sponsor_block_notifications_title"/>
<PreferenceScreen
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_api_url_key"
android:fragment="org.schabi.newpipe.settings.SponsorBlockCategoriesSettingsFragment"
android:key="@string/sponsor_block_categories_key"
android:title="@string/settings_category_sponsor_block_categories_title"
android:summary="@string/settings_category_sponsor_block_categories_summary"/>
<Preference
app:iconSpaceReserved="false"
android:key="@string/sponsor_block_clear_whitelist_key"
android:summary="@string/sponsor_block_clear_whitelist_summary"
android:title="@string/sponsor_block_clear_whitelist_title"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -46,4 +46,16 @@
android:key="update_pref_screen_key"
android:title="@string/settings_category_updates_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.SponsorBlockSettingsFragment"
android:icon="?attr/ic_sponsor_block_enable"
android:title="@string/sponsor_block"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.ExtraSettingsFragment"
android:icon="?attr/ic_asterisk"
android:title="@string/extras"
app:iconSpaceReserved="false" />
</PreferenceScreen>