From 701ed7cece49adee66de1f3d755765e427e44f80 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 20 Jun 2020 11:14:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8DNavigationBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/App.kt | 2 ++ app/src/main/java/io/legado/app/base/BaseActivity.kt | 1 + app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index dde82c946..05d6f1837 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -71,6 +71,7 @@ class App : Application() { fun applyTheme() { if (AppConfig.isNightTheme) { ThemeStore.editTheme(this) + .coloredNavigationBar(true) .primaryColor( getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) ).accentColor( @@ -82,6 +83,7 @@ class App : Application() { ).apply() } else { ThemeStore.editTheme(this) + .coloredNavigationBar(true) .primaryColor( getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_indigo_800)) ).accentColor( diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index e0d4713d7..e98c7cdea 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -107,6 +107,7 @@ abstract class BaseActivity( } else if (theme == Theme.Light) { ATH.setLightStatusBar(this, true) } + ATH.setNavigationBarColorAuto(this) } open fun observeLiveBus() { 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 415938c22..4259b6a7c 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 @@ -237,7 +237,10 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { fun navigationBarColor(context: Context): Int { return if (!coloredNavigationBar(context)) { Color.BLACK - } else prefs(context).getInt(ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, primaryColor(context)) + } else prefs(context).getInt( + ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, + bottomBackground(context) + ) } @CheckResult