From e7eb59c6ef5fb7e08f37a87f115943581679e35f Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 25 Jan 2021 23:06:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=9B=BE=E7=89=87=E8=83=8C?= =?UTF-8?q?=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/config/ThemeConfigFragment.kt | 17 +++++++++++------ .../java/io/legado/app/ui/main/my/MyFragment.kt | 2 +- app/src/main/res/xml/pref_config_theme.xml | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index dbe344a53..8248a840a 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -30,7 +30,7 @@ import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.ATH import io.legado.app.ui.widget.number.NumberPickerDialog import io.legado.app.ui.widget.prefs.ColorPreference -import io.legado.app.ui.widget.prefs.IconListPreference +import io.legado.app.ui.widget.prefs.PreferenceCategory import io.legado.app.utils.* import java.io.File @@ -45,13 +45,18 @@ class ThemeConfigFragment : BasePreferenceFragment(), override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.pref_config_theme) if (Build.VERSION.SDK_INT < 26) { - findPreference(PreferKey.launcherIcon)?.let { - preferenceScreen.removePreference(it) - } + preferenceScreen.removePreferenceRecursively(PreferKey.launcherIcon) + } + if (AppConfig.isGooglePlay) { + upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage)) + upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN)) + } else { + findPreference("dayThemeCategory") + ?.removePreferenceRecursively(PreferKey.bgImage) + findPreference("nightThemeCategory") + ?.removePreferenceRecursively(PreferKey.bgImageN) } upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString()) - upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage)) - upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN)) findPreference(PreferKey.cBackground)?.let { it.onSaveColor = { color -> if (!ColorUtils.isColorLight(color)) { diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index 1fb43003b..ce6065e27 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -96,7 +96,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FilePickerDialog.C } if (AppConfig.isGooglePlay) { findPreference("aboutCategory") - ?.removePreference(findPreference("donate")) + ?.removePreferenceRecursively("donate") } } diff --git a/app/src/main/res/xml/pref_config_theme.xml b/app/src/main/res/xml/pref_config_theme.xml index f5aae055a..ec131ec7a 100644 --- a/app/src/main/res/xml/pref_config_theme.xml +++ b/app/src/main/res/xml/pref_config_theme.xml @@ -42,6 +42,7 @@ app:iconSpaceReserved="false" />