From 216dfded4b00dc13e72d0488cf7fa0cd976ac1c2 Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:33:31 +0800 Subject: [PATCH] Fix downloads FAB animation --- .../main/kotlin/com/hippo/ehviewer/ui/tools/PredictiveBack.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/tools/PredictiveBack.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/tools/PredictiveBack.kt index 0183ad5da..bcb701667 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/tools/PredictiveBack.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/tools/PredictiveBack.kt @@ -45,6 +45,7 @@ fun animateFloatMergePredictiveBackAsState( ): State { val targetValue = if (enable) 0f else 1f val animatable = remember { Animatable(targetValue, Float.VectorConverter) } + val animSpec by rememberUpdatedState(animationSpec) val listener by rememberUpdatedState(finishedListener) val channel = remember { Channel(Channel.CONFLATED) } @@ -56,7 +57,7 @@ fun animateFloatMergePredictiveBackAsState( val newTarget = channel.tryReceive().getOrNull() ?: target launch { if (newTarget != animatable.targetValue) { - animatable.animateTo(newTarget, animationSpec) + animatable.animateTo(newTarget, animSpec) listener?.invoke(animatable.value) } }