mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Use non-nullable floats to fix random crashes on some systems
This commit is contained in:
@@ -48,7 +48,7 @@ fun KtorImage(
|
||||
BoxWithConstraints {
|
||||
val drawable: MutableState<ImageBitmap?> = remember { mutableStateOf(null) }
|
||||
val loading: MutableState<Boolean> = remember { mutableStateOf(true) }
|
||||
val progress: MutableState<Float?> = remember { mutableStateOf(null) }
|
||||
val progress: MutableState<Float> = remember { mutableStateOf(0.0F) }
|
||||
val error: MutableState<String?> = remember { mutableStateOf(null) }
|
||||
DisposableEffect(imageUrl) {
|
||||
val handler = CoroutineExceptionHandler { _, throwable ->
|
||||
|
||||
@@ -22,7 +22,7 @@ fun LoadingScreen(
|
||||
isLoading: Boolean = true,
|
||||
modifier: Modifier = Modifier.fillMaxSize(),
|
||||
/*@FloatRange(from = 0.0, to = 1.0)*/
|
||||
progress: Float? = null,
|
||||
progress: Float = 0.0F,
|
||||
errorMessage: String? = null,
|
||||
retryMessage: String = "Retry",
|
||||
retry: (() -> Unit)? = null
|
||||
@@ -33,10 +33,8 @@ fun LoadingScreen(
|
||||
val size = remember(maxHeight, maxWidth) {
|
||||
min(maxHeight, maxWidth) / 2
|
||||
}
|
||||
// Workaround for random `Cannot round NaN value.` exception
|
||||
val floatProgress = progress ?: 0F
|
||||
if (progress != null) {
|
||||
CircularProgressIndicator(floatProgress, Modifier.align(Alignment.Center).size(size))
|
||||
if (progress != 0.0F) {
|
||||
CircularProgressIndicator(progress, Modifier.align(Alignment.Center).size(size))
|
||||
} else {
|
||||
CircularProgressIndicator(Modifier.align(Alignment.Center).size(size))
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ fun ReaderMenu(chapterIndex: Int, mangaId: Long, setHotkeys: (List<KeyboardShort
|
||||
fun ReaderImage(
|
||||
imageIndex: Int,
|
||||
drawable: ImageBitmap?,
|
||||
progress: Float?,
|
||||
progress: Float,
|
||||
status: ReaderPage.Status,
|
||||
error: String?,
|
||||
imageModifier: Modifier = Modifier.fillMaxSize(),
|
||||
|
||||
@@ -112,7 +112,7 @@ class TachideskPageLoader(
|
||||
ReaderPage(
|
||||
it,
|
||||
MutableStateFlow(null),
|
||||
MutableStateFlow(null),
|
||||
MutableStateFlow(0.0F),
|
||||
MutableStateFlow(ReaderPage.Status.QUEUE),
|
||||
MutableStateFlow(null)
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
data class ReaderPage(
|
||||
val index: Int,
|
||||
val bitmap: MutableStateFlow<ImageBitmap?>,
|
||||
val progress: MutableStateFlow<Float?>,
|
||||
val progress: MutableStateFlow<Float>,
|
||||
val status: MutableStateFlow<Status>,
|
||||
val error: MutableStateFlow<String?>
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user