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 94bd38a64..4f1124ae4 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -167,7 +167,7 @@ abstract class BaseActivity( } open fun upNavigationBarColor() { - if (AppConfig.isTransparentStatusBar) { + if (AppConfig.immNavigationBar) { ATH.setNavigationBarColorAuto(this, ThemeStore.navigationBarColor(this)) } else { val nbColor = ColorUtils.darkenColor(ThemeStore.navigationBarColor(this)) diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 76a17bca1..a69fd3368 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -55,6 +55,7 @@ object PreferKey { const val autoReadSpeed = "autoReadSpeed" const val barElevation = "barElevation" const val transparentStatusBar = "transparentStatusBar" + const val immNavigationBar = "immNavigationBar" const val defaultCover = "defaultCover" const val replaceEnableDefault = "replaceEnableDefault" const val showBrightnessView = "showBrightnessView" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index d6854a306..2efcd482c 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -73,11 +73,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { } } - var isTransparentStatusBar: Boolean - get() = context.getPrefBoolean(PreferKey.transparentStatusBar) - set(value) { - context.putPrefBoolean(PreferKey.transparentStatusBar, value) - } + val isTransparentStatusBar: Boolean + get() = context.getPrefBoolean(PreferKey.transparentStatusBar, true) + + val immNavigationBar: Boolean + get() = context.getPrefBoolean(PreferKey.immNavigationBar, true) val screenDirection: String? get() = context.getPrefString(PreferKey.screenDirection) 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 22b4c1e80..e50ebf435 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 @@ -145,7 +145,7 @@ abstract class ReadBookBaseActivity : when { binding.readMenu.isVisible -> super.upNavigationBarColor() bottomDialog > 0 -> super.upNavigationBarColor() - else -> if (AppConfig.isTransparentStatusBar) { + else -> if (AppConfig.immNavigationBar) { ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT) } else { ATH.setNavigationBarColorAuto(this, Color.parseColor("#20000000")) 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 8a4f1863b..b7a29434e 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 @@ -133,6 +133,7 @@ class ThemeConfigFragment : BasePreferenceFragment(), when (key) { PreferKey.launcherIcon -> LauncherIconHelp.changeIcon(getPrefString(key)) PreferKey.transparentStatusBar -> recreateActivities() + PreferKey.immNavigationBar -> recreateActivities() PreferKey.cPrimary, PreferKey.cAccent, PreferKey.cBackground, diff --git a/app/src/main/java/io/legado/app/utils/SystemUtils.kt b/app/src/main/java/io/legado/app/utils/SystemUtils.kt index b8027528d..7faccc935 100644 --- a/app/src/main/java/io/legado/app/utils/SystemUtils.kt +++ b/app/src/main/java/io/legado/app/utils/SystemUtils.kt @@ -56,12 +56,16 @@ object SystemUtils { */ fun isNavigationBarExist(activity: Activity?): Boolean { activity?.let { - val vp = it.window.decorView as? ViewGroup - if (vp != null) { - for (i in 0 until vp.childCount) { - vp.getChildAt(i).context.packageName - if (vp.getChildAt(i).id != View.NO_ID - && NAVIGATION == activity.resources.getResourceEntryName(vp.getChildAt(i).id) + val viewGroup = it.window.decorView as? ViewGroup + if (viewGroup != null) { + for (i in 0 until viewGroup.childCount) { + viewGroup.getChildAt(i).context.packageName + if (viewGroup.getChildAt(i).id != View.NO_ID + && NAVIGATION == activity.resources.getResourceEntryName( + viewGroup.getChildAt( + i + ).id + ) ) { return true } diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 32146a70e..44d480018 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -361,8 +361,8 @@ 完結書籍 本地書籍 狀態欄顏色透明 - 導航欄變色 - 導航欄根據夜間模式變化 + 沉浸式导航栏 + 导航栏颜色透明 放入書架 繼續閲讀 封面地址 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 370eaeb0a..71781981d 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -362,8 +362,8 @@ 完結書籍 本機書籍 狀態欄顏色透明 - 導航欄變色 - 導航欄根據夜間模式變化 + 沉浸式导航栏 + 导航栏颜色透明 放入書架 繼續閱讀 封面地址 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 15c4f5604..4baf18b05 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -364,8 +364,8 @@ 完结书籍 本地书籍 状态栏颜色透明 - 导航栏变色 - 导航栏根据夜间模式变化 + 沉浸式导航栏 + 导航栏颜色透明 放入书架 继续阅读 封面地址 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 18e1473b0..b28807641 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -365,8 +365,8 @@ Finished books Local books The status bar color becomes transparent - Discolored navigation bar - The navigation bar changes color following the dark mode + immersion navigation bar + The navigation bar becomes transparent Add to Bookshelf Continue reading Cover path diff --git a/app/src/main/res/xml/pref_config_theme.xml b/app/src/main/res/xml/pref_config_theme.xml index 673332a25..081c49b37 100644 --- a/app/src/main/res/xml/pref_config_theme.xml +++ b/app/src/main/res/xml/pref_config_theme.xml @@ -20,10 +20,10 @@ app:iconSpaceReserved="false" />