diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index c8acea3cd..6d08494bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -610,7 +610,7 @@ class ReaderActivity : BaseRxActivity() binding.rightChapter.setTooltip(R.string.action_next_chapter) } - val loadingIndicatorContext = createReaderThemeContext(preferences.readerTheme().get()) + val loadingIndicatorContext = createReaderThemeContext() loadingIndicator = ReaderProgressIndicator(loadingIndicatorContext).apply { updateLayoutParams { gravity = Gravity.CENTER diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt index 6d70bdf28..24589ca0e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt @@ -37,7 +37,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() { * Context that has been wrapped to use the correct theme values based on the * current app theme and reader background color */ - private var readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme) + private var readerThemedContext = viewer.activity.createReaderThemeContext() /** * Updates this adapter with the given [chapters]. It handles setting a few pages of the @@ -197,6 +197,6 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() { } fun refresh() { - readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme) + readerThemedContext = viewer.activity.createReaderThemeContext() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt index a48c90060..5f17b4ce1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt @@ -29,7 +29,7 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter() + val isDarkBackground = when (prefs.readerTheme().get()) { 1, 2 -> true // Black, Gray 3 -> applicationContext.isNightMode() // Automatic bg uses activity background by default else -> false // White @@ -319,11 +323,10 @@ fun Context.createReaderThemeContext(readerThemeSelected: Int): Context { overrideConf.setTo(resources.configuration) overrideConf.uiMode = (overrideConf.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv()) or expected - val wrappedContext = ContextThemeWrapper(this, R.style.Theme_AppCompat_Empty) + val wrappedContext = ContextThemeWrapper(this, R.style.Theme_Tachiyomi) wrappedContext.applyOverrideConfiguration(overrideConf) - if (theme != null) { - ResourcesCompat.ThemeCompat.rebase(wrappedContext.theme) - } + BaseThemedActivity.getThemeResIds(prefs.appTheme().get(), prefs.themeDarkAmoled().get()) + .forEach { wrappedContext.theme.applyStyle(it, true) } return wrappedContext } return this