From a25cb8f3ebdaf02a3de7fd13ee7fef678bcd1c42 Mon Sep 17 00:00:00 2001 From: Acclorite <140836141+Acclorite@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:39:57 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Fix=20checkpoint=20last?= =?UTF-8?q?s=20after=20hiding=20bottom=20bar=20in=20Reader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/reader/ReaderBottomBar.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/reader/ReaderBottomBar.kt b/app/src/main/java/ua/acclorite/book_story/presentation/reader/ReaderBottomBar.kt index c8bd1659..ae1f534d 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/reader/ReaderBottomBar.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/reader/ReaderBottomBar.kt @@ -19,7 +19,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf -import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -69,7 +68,7 @@ fun ReaderBottomBar( } } - val arrowDirection by remember { + val arrowDirection = remember(checkpoint.index, listState.firstVisibleItemIndex) { derivedStateOf { val checkpointIndex = checkpoint.index val index = listState.firstVisibleItemIndex @@ -81,7 +80,7 @@ fun ReaderBottomBar( } } } - val checkpointProgress by remember { + val checkpointProgress = remember(checkpoint.index, text.lastIndex) { derivedStateOf { (checkpoint.index / text.lastIndex.toFloat()) * 0.987f } @@ -109,7 +108,7 @@ fun ReaderBottomBar( Row(verticalAlignment = Alignment.CenterVertically) { HorizontalExpandingTransition( - visible = arrowDirection == Direction.START, + visible = arrowDirection.value == Direction.START, startDirection = true ) { IconButton( @@ -135,13 +134,13 @@ fun ReaderBottomBar( changeProgress = changeProgress ) - if (arrowDirection != Direction.NEUTRAL) { - ReaderBottomBarSliderIndicator(progress = checkpointProgress) + if (arrowDirection.value != Direction.NEUTRAL) { + ReaderBottomBarSliderIndicator(progress = checkpointProgress.value) } } HorizontalExpandingTransition( - visible = arrowDirection == Direction.END, + visible = arrowDirection.value == Direction.END, startDirection = false ) { IconButton(