Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f2149af authored by Pat Manning's avatar Pat Manning
Browse files

Allow pausing touchpad tutorial animations on tap before gesture tracking has started.

Fix: 377640802
Test: Manual.
Flag: EXEMPT Bugfix.
Change-Id: I002b7cb2093ca4cfebb341588c95f393c2d5ba69
parent 8e18d4b6
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -23,13 +23,16 @@ import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.node.Ref
@@ -93,13 +96,19 @@ private fun EducationAnimation(
    animationProperties: LottieDynamicProperties,
) {
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(educationAnimationId))
    var isPlaying by remember { mutableStateOf(true) }
    val progress by
        animateLottieCompositionAsState(composition, iterations = LottieConstants.IterateForever)
        animateLottieCompositionAsState(
            composition,
            iterations = LottieConstants.IterateForever,
            isPlaying = isPlaying,
            restartOnPlay = false,
        )
    LottieAnimation(
        composition = composition,
        progress = { progress },
        dynamicProperties = animationProperties,
        modifier = Modifier.fillMaxSize(),
        modifier = Modifier.fillMaxSize().clickable { isPlaying = !isPlaying },
    )
}