From a2f2d562f6a2d4e9382e5b212c1232db6df195cd Mon Sep 17 00:00:00 2001 From: Jared Fantaye Date: Thu, 1 Dec 2022 13:01:58 +0100 Subject: [PATCH] Disabling night theme selection if auto theme is not used --- .../settings/AppearanceSettingsFragment.java | 14 ++++++-------- app/src/main/res/values/strings.xml | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java index 550d64d06..72ce0f201 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java @@ -44,7 +44,12 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment { return false; }); } else { - removePreference(nightThemeKey); + // disable the night theme selection + final Preference preference = findPreference(nightThemeKey); + if (preference != null) { + preference.setEnabled(false); + preference.setSummary(getString(R.string.night_theme_available)); + } } } @@ -61,13 +66,6 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment { return super.onPreferenceTreeClick(preference); } - private void removePreference(final String preferenceKey) { - final Preference preference = findPreference(preferenceKey); - if (preference != null) { - getPreferenceScreen().removePreference(preference); - } - } - private void applyThemeChange(final String beginningThemeKey, final String themeKey, final Object newValue) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3fa37155a..68f5f67a4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -714,6 +714,7 @@ Automatic (device theme) Select your favorite night theme — %s You can select your favorite night theme below + This option is only available if Automatic (Device Theme) is selected for Theme Download has started You can now select text inside the description. Note that the page may flicker and links may not be clickable while in selection mode. Enable selecting text in the description