From 3531a631e38bfe7f1599f8a554e0c979737c0728 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 22 Jun 2021 18:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/ThemeConfig.kt | 3 --- .../io/legado/app/lib/theme/ThemeStore.kt | 24 +++---------------- .../app/lib/theme/ThemeStoreInterface.kt | 6 ----- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ThemeConfig.kt b/app/src/main/java/io/legado/app/help/ThemeConfig.kt index 409b5be24..f0fdab71b 100644 --- a/app/src/main/java/io/legado/app/help/ThemeConfig.kt +++ b/app/src/main/java/io/legado/app/help/ThemeConfig.kt @@ -173,7 +173,6 @@ object ThemeConfig { when { AppConfig.isEInkMode -> { ThemeStore.editTheme(this) - .coloredNavigationBar(true) .primaryColor(Color.WHITE) .accentColor(Color.BLACK) .backgroundColor(Color.WHITE) @@ -194,7 +193,6 @@ object ThemeConfig { val bBackground = getPrefInt(PreferKey.cNBBackground, getCompatColor(R.color.md_grey_850)) ThemeStore.editTheme(this) - .coloredNavigationBar(true) .primaryColor(ColorUtils.withAlpha(primary, 1f)) .accentColor(ColorUtils.withAlpha(accent, 1f)) .backgroundColor(ColorUtils.withAlpha(background, 1f)) @@ -215,7 +213,6 @@ object ThemeConfig { val bBackground = getPrefInt(PreferKey.cBBackground, getCompatColor(R.color.md_grey_200)) ThemeStore.editTheme(this) - .coloredNavigationBar(true) .primaryColor(ColorUtils.withAlpha(primary, 1f)) .accentColor(ColorUtils.withAlpha(accent, 1f)) .backgroundColor(ColorUtils.withAlpha(background, 1f)) diff --git a/app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt b/app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt index ab88e798f..040a04da0 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt @@ -19,12 +19,8 @@ import splitties.init.appCtx @Suppress("unused") class ThemeStore @SuppressLint("CommitPrefEdits") private constructor(private val mContext: Context) : ThemeStoreInterface { - private val mEditor: SharedPreferences.Editor - - init { - mEditor = prefs(mContext).edit() - } + private val mEditor = prefs(mContext).edit() override fun primaryColor(@ColorInt color: Int): ThemeStore { mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, color) @@ -155,16 +151,6 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { return this } - override fun coloredStatusBar(colored: Boolean): ThemeStore { - mEditor.putBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARYDARK_STATUSBAR, colored) - return this - } - - override fun coloredNavigationBar(applyToNavBar: Boolean): ThemeStore { - mEditor.putBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARY_NAVBAR, applyToNavBar) - return this - } - override fun autoGeneratePrimaryDark(autoGenerate: Boolean): ThemeStore { mEditor.putBoolean(ThemeStorePrefKeys.KEY_AUTO_GENERATE_PRIMARYDARK, autoGenerate) return this @@ -228,9 +214,7 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { @CheckResult @ColorInt fun statusBarColor(context: Context, transparent: Boolean): Int { - return if (!coloredStatusBar(context)) { - Color.BLACK - } else if (transparent) { + return if (transparent) { prefs(context).getInt( ThemeStorePrefKeys.KEY_STATUS_BAR_COLOR, primaryColor(context) @@ -246,9 +230,7 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { @CheckResult @ColorInt fun navigationBarColor(context: Context): Int { - return if (!coloredNavigationBar(context)) { - Color.BLACK - } else prefs(context).getInt( + return prefs(context).getInt( ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, bottomBackground(context) ) diff --git a/app/src/main/java/io/legado/app/lib/theme/ThemeStoreInterface.kt b/app/src/main/java/io/legado/app/lib/theme/ThemeStoreInterface.kt index 521b9d237..f7b3ae500 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ThemeStoreInterface.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ThemeStoreInterface.kt @@ -84,12 +84,6 @@ internal interface ThemeStoreInterface { fun bottomBackground(@ColorInt color: Int): ThemeStore - // Toggle configurations - - fun coloredStatusBar(colored: Boolean): ThemeStore - - fun coloredNavigationBar(applyToNavBar: Boolean): ThemeStore - // Commit/apply fun apply()