Try to ensure that reader page error message is removed if image is loaded
Maybe fixes #5687
This commit is contained in:
parent
443d56f69b
commit
4868dd2d03
4 changed files with 18 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
package eu.kanade.presentation.reader
|
||||
|
||||
import androidx.annotation.IntRange
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -10,7 +11,7 @@ import kotlin.math.abs
|
|||
|
||||
@Composable
|
||||
fun BrightnessOverlay(
|
||||
value: Int,
|
||||
@IntRange(from = -100, to = 100) value: Int,
|
||||
) {
|
||||
if (value >= 0) return
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader
|
|||
|
||||
import android.app.Application
|
||||
import android.net.Uri
|
||||
import androidx.annotation.IntRange
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
@ -900,7 +901,7 @@ class ReaderViewModel @JvmOverloads constructor(
|
|||
val viewer: Viewer? = null,
|
||||
val dialog: Dialog? = null,
|
||||
val menuVisible: Boolean = false,
|
||||
val brightnessOverlayValue: Int = 0,
|
||||
@IntRange(from = -100, to = 100) val brightnessOverlayValue: Int = 0,
|
||||
) {
|
||||
val currentChapter: ReaderChapter?
|
||||
get() = viewerChapters?.currChapter
|
||||
|
|
|
@ -109,7 +109,7 @@ class PagerPageHolder(
|
|||
*/
|
||||
private fun setQueued() {
|
||||
progressIndicator.show()
|
||||
errorLayout?.root?.isVisible = false
|
||||
removeErrorLayout()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ class PagerPageHolder(
|
|||
*/
|
||||
private fun setLoading() {
|
||||
progressIndicator.show()
|
||||
errorLayout?.root?.isVisible = false
|
||||
removeErrorLayout()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,7 @@ class PagerPageHolder(
|
|||
*/
|
||||
private fun setDownloading() {
|
||||
progressIndicator.show()
|
||||
errorLayout?.root?.isVisible = false
|
||||
removeErrorLayout()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,6 @@ class PagerPageHolder(
|
|||
*/
|
||||
private suspend fun setImage() {
|
||||
progressIndicator.setProgress(0)
|
||||
errorLayout?.root?.isVisible = false
|
||||
|
||||
val streamFn = page.stream ?: return
|
||||
|
||||
|
@ -170,6 +169,7 @@ class PagerPageHolder(
|
|||
pageBackground = background
|
||||
}
|
||||
}
|
||||
removeErrorLayout()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,4 +280,12 @@ class PagerPageHolder(
|
|||
errorLayout?.root?.isVisible = true
|
||||
return errorLayout!!
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the decode error layout from the holder, if found.
|
||||
*/
|
||||
private fun removeErrorLayout() {
|
||||
errorLayout?.root?.isVisible = false
|
||||
errorLayout = null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,6 @@ class WebtoonPageHolder(
|
|||
*/
|
||||
private suspend fun setImage() {
|
||||
progressIndicator.setProgress(0)
|
||||
removeErrorLayout()
|
||||
|
||||
val streamFn = page?.stream ?: return
|
||||
|
||||
|
@ -202,6 +201,7 @@ class WebtoonPageHolder(
|
|||
cropBorders = viewer.config.imageCropBorders,
|
||||
),
|
||||
)
|
||||
removeErrorLayout()
|
||||
}
|
||||
// Suspend the coroutine to close the input stream only when the WebtoonPageHolder is recycled
|
||||
suspendCancellableCoroutine<Nothing> { continuation ->
|
||||
|
@ -234,6 +234,7 @@ class WebtoonPageHolder(
|
|||
*/
|
||||
private fun onImageDecoded() {
|
||||
progressContainer.isVisible = false
|
||||
removeErrorLayout()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue