From 36b7ab5f1b4763a0c5909b1d71b81f17058e4d5b Mon Sep 17 00:00:00 2001 From: polymorphicshade Date: Tue, 15 Dec 2020 16:09:42 -0700 Subject: [PATCH] SponsorBlock: Added Disable TV UI extra setting, and other misc setting-related refactoring --- .../org/schabi/newpipe/util/DeviceUtils.java | 7 ++++++ app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 6 +++-- app/src/main/res/xml/extra_settings.xml | 13 ++++++++++ .../main/res/xml/sponsor_block_settings.xml | 24 ++++++++----------- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java index 6d9842ee9..a51b8658e 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java @@ -25,6 +25,13 @@ public final class DeviceUtils { } public static boolean isTv(final Context context) { + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + + if (prefs.getBoolean(context + .getString(R.string.disable_tv_ui_key), false)) { + return false; + } + if (isTV != null) { return isTV; } diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index be8c9fa2a..4ef6b2296 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -364,6 +364,7 @@ disable_tablet_ui + disable_tv_ui system diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7f53dc8f4..1cc9ae8a1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -707,7 +707,6 @@ Show thumbnail on lock screen as background and inside notifications SponsorBlock - Information View Website View the official SponsorBlock website. Skip Sponsors @@ -742,7 +741,10 @@ Colors reset. Extras + Tweaks, workarounds, and other miscellaneous settings belong here. Experimental Settings Disable Tablet UI - Ignore tablet layouts. This is intended for workarounds related to specific scenarios. + Ignore tablet layouts. This is intended for specific workarounds. You may need to restart the app to see the effects. + Disable TV UI + Ignore TV layouts. This is intended for specific workarounds. You may need to restart the app to see the effects. diff --git a/app/src/main/res/xml/extra_settings.xml b/app/src/main/res/xml/extra_settings.xml index 67979432a..342336027 100644 --- a/app/src/main/res/xml/extra_settings.xml +++ b/app/src/main/res/xml/extra_settings.xml @@ -3,6 +3,12 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:title="@string/extras"> + + @@ -13,5 +19,12 @@ android:key="@string/disable_tablet_ui_key" android:summary="@string/disable_tablet_ui_summary" android:title="@string/disable_tablet_ui_title"/> + + \ No newline at end of file diff --git a/app/src/main/res/xml/sponsor_block_settings.xml b/app/src/main/res/xml/sponsor_block_settings.xml index 89cb20539..0ea3ddb35 100644 --- a/app/src/main/res/xml/sponsor_block_settings.xml +++ b/app/src/main/res/xml/sponsor_block_settings.xml @@ -2,22 +2,18 @@ - - + - - +