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 c109d0e3b..881323bc6 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -80,13 +80,13 @@ abstract class BaseActivity(private val layoutID: Int, private val fullScreen: B window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - if (getPrefBoolean("transparentStatusBar")) { + if (isTransparentStatusBar) { window.statusBarColor = Color.TRANSPARENT } else { window.statusBarColor = getCompatColor(R.color.status_bar_bag) } } else { - window.statusBarColor = ThemeStore.statusBarColor(this, getPrefBoolean("transparentStatusBar")) + window.statusBarColor = ThemeStore.statusBarColor(this, isTransparentStatusBar) } } 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 1a2dad761..1b4bac585 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 @@ -13,6 +13,8 @@ import io.legado.app.constant.Bus import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ColorUtils import io.legado.app.utils.* +import kotlinx.coroutines.delay +import kotlinx.coroutines.runBlocking class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { @@ -140,6 +142,10 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar private fun recreateActivities() { postEvent(Bus.RECREATE, "") - Handler().postDelayed({ activity?.recreate() }, 100L) + runBlocking { + delay(100L) + activity?.recreate() + } } + } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt index 0a36b6a58..fd6b825d0 100644 --- a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt @@ -125,7 +125,6 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a this.subtitle = subtitleText } - backgroundColor = context.primaryColor } if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) { @@ -136,6 +135,8 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a bottomPadding = context.getNavigationBarHeight() } + backgroundColor = context.primaryColor + a.recycle() }