From 045bbd7c42ed5e996fae12f3d01e27b0804ec317 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 13 Dec 2020 17:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E9=9D=9E=E6=B2=89=E6=B5=B8=E6=98=AF=E9=A2=9C=E8=89=B2=E6=B7=B1?= =?UTF-8?q?=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/base/BaseActivity.kt | 9 ++++++++- app/src/main/java/io/legado/app/lib/theme/ATH.kt | 2 +- .../io/legado/app/ui/book/read/ReadBookBaseActivity.kt | 5 ++--- 3 files changed, 11 insertions(+), 5 deletions(-) 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 05539ad26..94bd38a64 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -15,7 +15,9 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.constant.Theme +import io.legado.app.help.AppConfig import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.widget.TitleBar @@ -165,7 +167,12 @@ abstract class BaseActivity( } open fun upNavigationBarColor() { - ATH.setNavigationBarColorAuto(this) + if (AppConfig.isTransparentStatusBar) { + ATH.setNavigationBarColorAuto(this, ThemeStore.navigationBarColor(this)) + } else { + val nbColor = ColorUtils.darkenColor(ThemeStore.navigationBarColor(this)) + ATH.setNavigationBarColorAuto(this, nbColor) + } } open fun observeLiveBus() { diff --git a/app/src/main/java/io/legado/app/lib/theme/ATH.kt b/app/src/main/java/io/legado/app/lib/theme/ATH.kt index 40e6b819f..f5274d09a 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ATH.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ATH.kt @@ -123,7 +123,7 @@ object ATH { fun setNavigationBarColorAuto( activity: Activity, - color: Int = ThemeStore.navigationBarColor(activity) + color: Int, ) { activity.window.navigationBarColor = color setLightNavigationBar(activity, ColorUtils.isColorLight(color)) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index eb7fcb90b..250a0ff38 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -24,7 +24,6 @@ import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.backgroundColor -import io.legado.app.lib.theme.bottomBackground import io.legado.app.service.help.CacheBook import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.config.BgTextConfigDialog @@ -144,8 +143,8 @@ abstract class ReadBookBaseActivity : override fun upNavigationBarColor() { when { - binding.readMenu.isVisible -> ATH.setNavigationBarColorAuto(this) - bottomDialog > 0 -> ATH.setNavigationBarColorAuto(this, bottomBackground) + binding.readMenu.isVisible -> super.upNavigationBarColor() + bottomDialog > 0 -> super.upNavigationBarColor() else -> if (AppConfig.isTransparentStatusBar) { ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT) } else {