From a2f2d562f6a2d4e9382e5b212c1232db6df195cd Mon Sep 17 00:00:00 2001 From: Jared Fantaye Date: Thu, 1 Dec 2022 13:01:58 +0100 Subject: [PATCH 1/2] 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 From 5fc85fa2e01ef95cffd59571a2c500d661354653 Mon Sep 17 00:00:00 2001 From: Jared Fantaye Date: Mon, 5 Dec 2022 21:21:46 +0100 Subject: [PATCH 2/2] Implemented suggestions --- .../schabi/newpipe/settings/AppearanceSettingsFragment.java | 3 ++- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 3 insertions(+), 2 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 72ce0f201..ef0e8670c 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java @@ -48,7 +48,8 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment { final Preference preference = findPreference(nightThemeKey); if (preference != null) { preference.setEnabled(false); - preference.setSummary(getString(R.string.night_theme_available)); + preference.setSummary(getString(R.string.night_theme_available, + getString(R.string.auto_device_theme_title))); } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 68f5f67a4..d4172ff36 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -714,7 +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 + This option is only available if %s 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