SponsorBlock: Added Disable TV UI extra setting, and other misc setting-related refactoring

This commit is contained in:
polymorphicshade 2020-12-15 16:09:42 -07:00
parent bbf4233788
commit 36b7ab5f1b
5 changed files with 35 additions and 16 deletions

View file

@ -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;
}

View file

@ -364,6 +364,7 @@
<!-- Extras -->
<string name="disable_tablet_ui_key" translatable="false">disable_tablet_ui</string>
<string name="disable_tv_ui_key" translatable="false">disable_tv_ui</string>
<!-- Localizations -->
<string name="default_localization_key" translatable="false">system</string>

View file

@ -707,7 +707,6 @@
<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>
@ -742,7 +741,10 @@
<string name="sponsor_block_reset_colors_toast">Colors reset.</string>
<!-- Extras -->
<string name="extras">Extras</string>
<string name="extras_todo_summary">Tweaks, workarounds, and other miscellaneous settings belong here.</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>
<string name="disable_tablet_ui_summary">Ignore tablet layouts. This is intended for specific workarounds. You may need to restart the app to see the effects.</string>
<string name="disable_tv_ui_title">Disable TV UI</string>
<string name="disable_tv_ui_summary">Ignore TV layouts. This is intended for specific workarounds. You may need to restart the app to see the effects.</string>
</resources>

View file

@ -3,6 +3,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/extras">
<Preference
app:iconSpaceReserved="false"
android:selectable="false"
android:persistent="false"
android:summary="@string/extras_todo_summary"/>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/experimental_settings">
@ -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"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="false"
android:key="@string/disable_tv_ui_key"
android:summary="@string/disable_tv_ui_summary"
android:title="@string/disable_tv_ui_title"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -2,22 +2,18 @@
<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_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>
<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
android:layout="@layout/settings_category_header_layout"