From 38d6ab80ce868707829dbc81de4170afe3c2f2a5 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:33:50 +0600 Subject: [PATCH] Fix "Flash on page change" gives black screen on page change Fixes #108 --- .../kanade/presentation/reader/DisplayRefreshHost.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/reader/DisplayRefreshHost.kt b/app/src/main/java/eu/kanade/presentation/reader/DisplayRefreshHost.kt index f0afd08a9f..82d3cad0fa 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/DisplayRefreshHost.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/DisplayRefreshHost.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import kotlinx.coroutines.delay +import kotlin.time.Duration.Companion.seconds @Stable class DisplayRefreshHost { @@ -30,15 +31,15 @@ fun DisplayRefreshHost( val currentDisplayRefresh = hostState.currentDisplayRefresh LaunchedEffect(currentDisplayRefresh) { if (currentDisplayRefresh) { - delay(1500) + delay(1.5.seconds) hostState.currentDisplayRefresh = false } } - if (currentDisplayRefresh) { - Canvas( - modifier = modifier.fillMaxSize(), - ) { + Canvas( + modifier = modifier.fillMaxSize(), + ) { + if (currentDisplayRefresh) { drawRect(Color.Black) } }