From f1cc4a35dc2662077be742bf8bd86e5d42ce1a50 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sun, 18 Apr 2021 02:22:19 -0400 Subject: [PATCH] Fixes to themes and theme changing in webview --- .../kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt | 9 ++++++++- app/src/main/res/layout/webview_activity.xml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt index 1fd527cc0d..29f658510f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt @@ -14,6 +14,7 @@ import androidx.core.graphics.ColorUtils import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.WebviewActivityBinding import eu.kanade.tachiyomi.ui.base.activity.BaseActivity +import eu.kanade.tachiyomi.util.system.getPrefTheme import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.isBottomTappable import eu.kanade.tachiyomi.util.system.isInNightMode @@ -39,7 +40,11 @@ open class BaseWebViewActivity : BaseActivity() { binding.toolbar.setNavigationOnClickListener { super.onBackPressed() } - binding.toolbar.navigationIcon?.setTint(getResourceColor(R.attr.actionBarTintColor)) + val tintColor = getResourceColor(R.attr.actionBarTintColor) + binding.toolbar.navigationIcon?.setTint(tintColor) + binding.toolbar.navigationIcon?.setTint(tintColor) + binding.toolbar.overflowIcon?.mutate() + binding.toolbar.overflowIcon?.setTint(tintColor) val container: ViewGroup = findViewById(R.id.web_view_layout) val content: LinearLayout = binding.webLinearLayout @@ -145,6 +150,7 @@ open class BaseWebViewActivity : BaseActivity() { override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) val lightMode = !isInNightMode() + setTheme(getPrefTheme(preferences).styleRes) window.statusBarColor = ColorUtils.setAlphaComponent( getResourceColor( R.attr @@ -160,6 +166,7 @@ open class BaseWebViewActivity : BaseActivity() { binding.toolbar.overflowIcon?.mutate() binding.toolbar.setTitleTextColor(tintColor) binding.toolbar.overflowIcon?.setTint(tintColor) + binding.swipeRefresh.setStyle() if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { window.navigationBarColor = getResourceColor(R.attr.colorPrimaryVariant) diff --git a/app/src/main/res/layout/webview_activity.xml b/app/src/main/res/layout/webview_activity.xml index eea7643bf6..db7a0bb3c2 100644 --- a/app/src/main/res/layout/webview_activity.xml +++ b/app/src/main/res/layout/webview_activity.xml @@ -22,6 +22,7 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorSecondary" android:theme="?attr/actionBarTheme" + app:titleTextColor="?actionBarTintColor" app:navigationIcon="@drawable/ic_close_24dp" app:layout_scrollFlags="scroll|enterAlways" />