mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Fix reader race conditions and loading page height
This commit is contained in:
@@ -446,7 +446,9 @@ fun ReaderLayout(
|
||||
progress: (Int) -> Unit,
|
||||
updateLastPageReadOffset: (Int) -> Unit
|
||||
) {
|
||||
val loadingModifier = Modifier.fillMaxWidth().aspectRatio(mangaAspectRatio)
|
||||
val loadingModifier = Modifier.widthIn(max = 700.dp)
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(mangaAspectRatio)
|
||||
val readerModifier = Modifier
|
||||
.navigationClickable(
|
||||
navigation = navigationViewer,
|
||||
@@ -524,11 +526,11 @@ fun ReaderImage(
|
||||
retry: (Int) -> Unit
|
||||
) {
|
||||
Crossfade(drawableHolder to status) { (drawableHolder, status) ->
|
||||
val drawableCallback = drawableHolder.item
|
||||
val decodeState = produceState<ReaderPage.ImageDecodeState?>(null, drawableCallback) {
|
||||
if (drawableCallback != null) {
|
||||
val decodeState = produceState<ReaderPage.ImageDecodeState?>(null, drawableHolder) {
|
||||
val callback = drawableHolder.item
|
||||
if (callback != null) {
|
||||
withIOContext {
|
||||
value = drawableCallback()
|
||||
value = callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -543,7 +545,7 @@ fun ReaderImage(
|
||||
)
|
||||
} else {
|
||||
LoadingScreen(
|
||||
status == ReaderPage.Status.QUEUE,
|
||||
status == ReaderPage.Status.QUEUE || status == ReaderPage.Status.WORKING,
|
||||
loadingModifier,
|
||||
progress,
|
||||
error ?: when (decode) {
|
||||
|
||||
@@ -80,6 +80,7 @@ class TachideskPageLoader(
|
||||
val page = priorityPage.page
|
||||
log.debug { "Loading page ${page.index}" }
|
||||
if (page.status.value == ReaderPage.Status.QUEUE) {
|
||||
page.status.value = ReaderPage.Status.WORKING
|
||||
getChapterPage.asFlow(chapter.chapter, page.index) {
|
||||
onDownload { bytesSentTotal, contentLength ->
|
||||
page.progress.value = (bytesSentTotal.toFloat() / contentLength).coerceAtMost(1.0F)
|
||||
|
||||
@@ -22,6 +22,7 @@ data class ReaderPage(
|
||||
) {
|
||||
enum class Status {
|
||||
QUEUE,
|
||||
WORKING,
|
||||
READY,
|
||||
ERROR
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user