feat: 适配NavigationBar

pull/248/head
gedoor 4 years ago
parent db7fc03ef9
commit 701ed7cece
  1. 2
      app/src/main/java/io/legado/app/App.kt
  2. 1
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  3. 5
      app/src/main/java/io/legado/app/lib/theme/ThemeStore.kt

@ -71,6 +71,7 @@ class App : Application() {
fun applyTheme() { fun applyTheme() {
if (AppConfig.isNightTheme) { if (AppConfig.isNightTheme) {
ThemeStore.editTheme(this) ThemeStore.editTheme(this)
.coloredNavigationBar(true)
.primaryColor( .primaryColor(
getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600))
).accentColor( ).accentColor(
@ -82,6 +83,7 @@ class App : Application() {
).apply() ).apply()
} else { } else {
ThemeStore.editTheme(this) ThemeStore.editTheme(this)
.coloredNavigationBar(true)
.primaryColor( .primaryColor(
getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_indigo_800)) getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_indigo_800))
).accentColor( ).accentColor(

@ -107,6 +107,7 @@ abstract class BaseActivity(
} else if (theme == Theme.Light) { } else if (theme == Theme.Light) {
ATH.setLightStatusBar(this, true) ATH.setLightStatusBar(this, true)
} }
ATH.setNavigationBarColorAuto(this)
} }
open fun observeLiveBus() { open fun observeLiveBus() {

@ -237,7 +237,10 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
fun navigationBarColor(context: Context): Int { fun navigationBarColor(context: Context): Int {
return if (!coloredNavigationBar(context)) { return if (!coloredNavigationBar(context)) {
Color.BLACK 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 @CheckResult

Loading…
Cancel
Save