diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index 11cad18df..3d209a9d4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -97,6 +97,12 @@ class PagerPageHolder( */ private var readImageHeaderSubscription: Subscription? = null + /** + * Context that has been wrapped to use the correct theme values based on the + * current app theme and reader background color + */ + private val readerThemedContext = context.createReaderThemeContext(viewer.config.theme) + val stateChangedListener = object : SubsamplingScaleImageView.OnStateChangedListener { override fun onScaleChanged(newScale: Float, origin: Int) { viewer.activity.hideMenu() @@ -115,8 +121,7 @@ class PagerPageHolder( } init { - val indicatorContext = context.createReaderThemeContext(viewer.config.theme) - progressIndicator = ReaderProgressIndicator(indicatorContext).apply { + progressIndicator = ReaderProgressIndicator(readerThemedContext).apply { updateLayoutParams { gravity = Gravity.CENTER } @@ -418,7 +423,7 @@ class PagerPageHolder( private fun initRetryButton(): PagerButton { if (retryButton != null) return retryButton!! - retryButton = PagerButton(context, viewer).apply { + retryButton = PagerButton(readerThemedContext, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { gravity = Gravity.CENTER } @@ -445,7 +450,7 @@ class PagerPageHolder( } decodeErrorLayout = decodeLayout - TextView(context).apply { + TextView(readerThemedContext).apply { layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) } @@ -455,7 +460,7 @@ class PagerPageHolder( decodeLayout.addView(this) } - PagerButton(context, viewer).apply { + PagerButton(readerThemedContext, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) } @@ -469,7 +474,7 @@ class PagerPageHolder( val imageUrl = page.imageUrl if (imageUrl.orEmpty().startsWith("http", true)) { - PagerButton(context, viewer).apply { + PagerButton(readerThemedContext, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) } diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 27e408124..cb132c8a9 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -42,7 +42,9 @@ false false @style/TextAppearance.Widget.Menu + @style/ThemeOverlay.Tachiyomi.MaterialAlertDialog @style/TextAppearance.Widget.Button + ?attr/borderlessButtonStyle 0.32 true @style/Widget.Tachiyomi.ActionMode