From 5e1c63c25271966636f74c3c490d629d407f76ee Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 19 Oct 2023 11:04:20 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../home/compose/views/StoriesProgressBar.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/home/compose/views/StoriesProgressBar.kt b/app/src/main/java/com/tangem/tap/features/home/compose/views/StoriesProgressBar.kt index cd53fdd0d3..a8a1fd7bc1 100644 --- a/app/src/main/java/com/tangem/tap/features/home/compose/views/StoriesProgressBar.kt +++ b/app/src/main/java/com/tangem/tap/features/home/compose/views/StoriesProgressBar.kt @@ -36,24 +36,26 @@ fun StoriesProgressBar( val animatorSpeed = Settings.Global.getFloat( context.contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, - 0f, + 1f, ) - LaunchedEffect(paused, currentStep) { + LaunchedEffect(paused, currentStep, animatorSpeed) { if (paused) { progress.stop() } else { if (animatorSpeed == 0f) { + progress.snapTo(1f) delay(STORIES_ANIMATION_SPEED_ZERO_DURATION) + } else { + progress.animateTo( + targetValue = 1f, + animationSpec = tween( + durationMillis = (stepDuration * (1f - progress.value)).toInt(), + easing = LinearEasing, + ), + ) + progress.snapTo(0f) } - progress.animateTo( - targetValue = 1f, - animationSpec = tween( - durationMillis = (stepDuration * (1f - progress.value)).toInt(), - easing = LinearEasing, - ), - ) - progress.snapTo(0f) onStepFinish() } }