From 87f3bb9767754006e47900fe30af462258ac1099 Mon Sep 17 00:00:00 2001 From: Administrator <1760316362@qq.com> Date: Thu, 1 Aug 2019 16:18:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= 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 | 4 ++-- .../java/io/legado/app/ui/config/ThemeConfigFragment.kt | 8 +++++++- app/src/main/java/io/legado/app/ui/widget/TitleBar.kt | 3 ++- 3 files changed, 11 insertions(+), 4 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 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() }