mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Apply app theme styling to reader page errors and progress dialog (#5705)
This commit is contained in:
parent
feca30d7ed
commit
d1bb0fdf1d
@ -97,6 +97,12 @@ class PagerPageHolder(
|
|||||||
*/
|
*/
|
||||||
private var readImageHeaderSubscription: Subscription? = null
|
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 {
|
val stateChangedListener = object : SubsamplingScaleImageView.OnStateChangedListener {
|
||||||
override fun onScaleChanged(newScale: Float, origin: Int) {
|
override fun onScaleChanged(newScale: Float, origin: Int) {
|
||||||
viewer.activity.hideMenu()
|
viewer.activity.hideMenu()
|
||||||
@ -115,8 +121,7 @@ class PagerPageHolder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val indicatorContext = context.createReaderThemeContext(viewer.config.theme)
|
progressIndicator = ReaderProgressIndicator(readerThemedContext).apply {
|
||||||
progressIndicator = ReaderProgressIndicator(indicatorContext).apply {
|
|
||||||
updateLayoutParams<LayoutParams> {
|
updateLayoutParams<LayoutParams> {
|
||||||
gravity = Gravity.CENTER
|
gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
@ -418,7 +423,7 @@ class PagerPageHolder(
|
|||||||
private fun initRetryButton(): PagerButton {
|
private fun initRetryButton(): PagerButton {
|
||||||
if (retryButton != null) return retryButton!!
|
if (retryButton != null) return retryButton!!
|
||||||
|
|
||||||
retryButton = PagerButton(context, viewer).apply {
|
retryButton = PagerButton(readerThemedContext, viewer).apply {
|
||||||
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||||
gravity = Gravity.CENTER
|
gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
@ -445,7 +450,7 @@ class PagerPageHolder(
|
|||||||
}
|
}
|
||||||
decodeErrorLayout = decodeLayout
|
decodeErrorLayout = decodeLayout
|
||||||
|
|
||||||
TextView(context).apply {
|
TextView(readerThemedContext).apply {
|
||||||
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||||
setMargins(margins, margins, margins, margins)
|
setMargins(margins, margins, margins, margins)
|
||||||
}
|
}
|
||||||
@ -455,7 +460,7 @@ class PagerPageHolder(
|
|||||||
decodeLayout.addView(this)
|
decodeLayout.addView(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
PagerButton(context, viewer).apply {
|
PagerButton(readerThemedContext, viewer).apply {
|
||||||
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||||
setMargins(margins, margins, margins, margins)
|
setMargins(margins, margins, margins, margins)
|
||||||
}
|
}
|
||||||
@ -469,7 +474,7 @@ class PagerPageHolder(
|
|||||||
|
|
||||||
val imageUrl = page.imageUrl
|
val imageUrl = page.imageUrl
|
||||||
if (imageUrl.orEmpty().startsWith("http", true)) {
|
if (imageUrl.orEmpty().startsWith("http", true)) {
|
||||||
PagerButton(context, viewer).apply {
|
PagerButton(readerThemedContext, viewer).apply {
|
||||||
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||||
setMargins(margins, margins, margins, margins)
|
setMargins(margins, margins, margins, margins)
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,9 @@
|
|||||||
<item name="android:enforceNavigationBarContrast" tools:targetApi="Q">false</item>
|
<item name="android:enforceNavigationBarContrast" tools:targetApi="Q">false</item>
|
||||||
<item name="android:enforceStatusBarContrast" tools:targetApi="Q">false</item>
|
<item name="android:enforceStatusBarContrast" tools:targetApi="Q">false</item>
|
||||||
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
|
||||||
|
<item name="android:alertDialogTheme">@style/ThemeOverlay.Tachiyomi.MaterialAlertDialog</item>
|
||||||
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
||||||
|
<item name="android:buttonStyle">?attr/borderlessButtonStyle</item>
|
||||||
<item name="android:backgroundDimAmount">0.32</item>
|
<item name="android:backgroundDimAmount">0.32</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
<item name="actionModeStyle">@style/Widget.Tachiyomi.ActionMode</item>
|
<item name="actionModeStyle">@style/Widget.Tachiyomi.ActionMode</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user