SponsorBlock: Added Disable TV UI extra setting, and other misc setting-related refactoring
This commit is contained in:
parent
bbf4233788
commit
36b7ab5f1b
5 changed files with 35 additions and 16 deletions
|
@ -25,6 +25,13 @@ public final class DeviceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTv(final Context context) {
|
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) {
|
if (isTV != null) {
|
||||||
return isTV;
|
return isTV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,6 +364,7 @@
|
||||||
|
|
||||||
<!-- Extras -->
|
<!-- Extras -->
|
||||||
<string name="disable_tablet_ui_key" translatable="false">disable_tablet_ui</string>
|
<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 -->
|
<!-- Localizations -->
|
||||||
<string name="default_localization_key" translatable="false">system</string>
|
<string name="default_localization_key" translatable="false">system</string>
|
||||||
|
|
|
@ -707,7 +707,6 @@
|
||||||
<string name="show_thumbnail_summary">Show thumbnail on lock screen as background and inside notifications</string>
|
<string name="show_thumbnail_summary">Show thumbnail on lock screen as background and inside notifications</string>
|
||||||
<!-- SponsorBlock -->
|
<!-- SponsorBlock -->
|
||||||
<string name="sponsor_block">SponsorBlock</string>
|
<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_title">View Website</string>
|
||||||
<string name="sponsor_block_home_page_summary">View the official SponsorBlock website.</string>
|
<string name="sponsor_block_home_page_summary">View the official SponsorBlock website.</string>
|
||||||
<string name="sponsor_block_enable_title">Skip Sponsors</string>
|
<string name="sponsor_block_enable_title">Skip Sponsors</string>
|
||||||
|
@ -742,7 +741,10 @@
|
||||||
<string name="sponsor_block_reset_colors_toast">Colors reset.</string>
|
<string name="sponsor_block_reset_colors_toast">Colors reset.</string>
|
||||||
<!-- Extras -->
|
<!-- Extras -->
|
||||||
<string name="extras">Extras</string>
|
<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="experimental_settings">Experimental Settings</string>
|
||||||
<string name="disable_tablet_ui_title">Disable Tablet UI</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>
|
</resources>
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/extras">
|
android:title="@string/extras">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
android:selectable="false"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="@string/extras_todo_summary"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:layout="@layout/settings_category_header_layout"
|
android:layout="@layout/settings_category_header_layout"
|
||||||
android:title="@string/experimental_settings">
|
android:title="@string/experimental_settings">
|
||||||
|
@ -13,5 +19,12 @@
|
||||||
android:key="@string/disable_tablet_ui_key"
|
android:key="@string/disable_tablet_ui_key"
|
||||||
android:summary="@string/disable_tablet_ui_summary"
|
android:summary="@string/disable_tablet_ui_summary"
|
||||||
android:title="@string/disable_tablet_ui_title"/>
|
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>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -2,22 +2,18 @@
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/sponsor_block">
|
android:title="@string/sponsor_block">
|
||||||
<PreferenceCategory
|
|
||||||
android:layout="@layout/settings_category_header_layout"
|
|
||||||
android:title="@string/sponsor_block_information">
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:key="@string/sponsor_block_home_page_key"
|
android:key="@string/sponsor_block_home_page_key"
|
||||||
android:summary="@string/sponsor_block_home_page_summary"
|
android:summary="@string/sponsor_block_home_page_summary"
|
||||||
android:title="@string/sponsor_block_home_page_title"/>
|
android:title="@string/sponsor_block_home_page_title"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:key="@string/sponsor_block_privacy_key"
|
android:key="@string/sponsor_block_privacy_key"
|
||||||
android:summary="@string/sponsor_block_privacy_summary"
|
android:summary="@string/sponsor_block_privacy_summary"
|
||||||
android:title="@string/sponsor_block_privacy_title"/>
|
android:title="@string/sponsor_block_privacy_title"/>
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:layout="@layout/settings_category_header_layout"
|
android:layout="@layout/settings_category_header_layout"
|
||||||
|
|
Loading…
Reference in a new issue