pull/32/head
Administrator 5 years ago
parent 6616df35e7
commit 87f3bb9767
  1. 4
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 8
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  3. 3
      app/src/main/java/io/legado/app/ui/widget/TitleBar.kt

@ -80,13 +80,13 @@ abstract class BaseActivity(private val layoutID: Int, private val fullScreen: B
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
if (getPrefBoolean("transparentStatusBar")) { if (isTransparentStatusBar) {
window.statusBarColor = Color.TRANSPARENT window.statusBarColor = Color.TRANSPARENT
} else { } else {
window.statusBarColor = getCompatColor(R.color.status_bar_bag) window.statusBarColor = getCompatColor(R.color.status_bar_bag)
} }
} else { } else {
window.statusBarColor = ThemeStore.statusBarColor(this, getPrefBoolean("transparentStatusBar")) window.statusBarColor = ThemeStore.statusBarColor(this, isTransparentStatusBar)
} }
} }

@ -13,6 +13,8 @@ import io.legado.app.constant.Bus
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.ColorUtils
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener {
@ -140,6 +142,10 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar
private fun recreateActivities() { private fun recreateActivities() {
postEvent(Bus.RECREATE, "") postEvent(Bus.RECREATE, "")
Handler().postDelayed({ activity?.recreate() }, 100L) runBlocking {
delay(100L)
activity?.recreate()
}
} }
} }

@ -125,7 +125,6 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a
this.subtitle = subtitleText this.subtitle = subtitleText
} }
backgroundColor = context.primaryColor
} }
if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) { if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) {
@ -136,6 +135,8 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a
bottomPadding = context.getNavigationBarHeight() bottomPadding = context.getNavigationBarHeight()
} }
backgroundColor = context.primaryColor
a.recycle() a.recycle()
} }

Loading…
Cancel
Save