Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt +1 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ internal fun PredictiveBackHandler( // The predictive back APIs will automatically animate the progress for us in this case // so there is no need to animate it. cancelSpec = snap(), animationScope = layoutImpl.animationScope, ) } } Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt +17 −6 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import com.android.compose.animation.scene.TransitionKey import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.createSwipeAnimation import kotlin.coroutines.cancellation.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collectLatest Loading Loading @@ -141,6 +143,7 @@ internal suspend fun <T : ContentKey> animateProgress( progress: Flow<Float>, commitSpec: AnimationSpec<Float>?, cancelSpec: AnimationSpec<Float>?, animationScope: CoroutineScope? = null, ) { fun animateOffset(targetContent: T, spec: AnimationSpec<Float>?) { if (state.transitionState != animation.contentTransition || animation.isAnimatingOffset()) { Loading Loading @@ -176,12 +179,20 @@ internal suspend fun <T : ContentKey> animateProgress( } // Start the transition. state.startTransition(animation.contentTransition) // The transition is done. Cancel the collection in case the transition was finished because // it was interrupted by another transition. if (collectionJob.isActive) { collectionJob.cancel() animationScope?.launch { startTransition(state, animation, collectionJob) } ?: startTransition(state, animation, collectionJob) } } private suspend fun <T : ContentKey> startTransition( state: MutableSceneTransitionLayoutStateImpl, animation: SwipeAnimation<T>, progressCollectionJob: Job, ) { state.startTransition(animation.contentTransition) // The transition is done. Cancel the collection in case the transition was finished // because it was interrupted by another transition. if (progressCollectionJob.isActive) { progressCollectionJob.cancel() } } Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/PredictiveBackHandler.kt +1 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ internal fun PredictiveBackHandler( // The predictive back APIs will automatically animate the progress for us in this case // so there is no need to animate it. cancelSpec = snap(), animationScope = layoutImpl.animationScope, ) } } Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/transition/Seek.kt +17 −6 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import com.android.compose.animation.scene.TransitionKey import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.createSwipeAnimation import kotlin.coroutines.cancellation.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collectLatest Loading Loading @@ -141,6 +143,7 @@ internal suspend fun <T : ContentKey> animateProgress( progress: Flow<Float>, commitSpec: AnimationSpec<Float>?, cancelSpec: AnimationSpec<Float>?, animationScope: CoroutineScope? = null, ) { fun animateOffset(targetContent: T, spec: AnimationSpec<Float>?) { if (state.transitionState != animation.contentTransition || animation.isAnimatingOffset()) { Loading Loading @@ -176,12 +179,20 @@ internal suspend fun <T : ContentKey> animateProgress( } // Start the transition. state.startTransition(animation.contentTransition) // The transition is done. Cancel the collection in case the transition was finished because // it was interrupted by another transition. if (collectionJob.isActive) { collectionJob.cancel() animationScope?.launch { startTransition(state, animation, collectionJob) } ?: startTransition(state, animation, collectionJob) } } private suspend fun <T : ContentKey> startTransition( state: MutableSceneTransitionLayoutStateImpl, animation: SwipeAnimation<T>, progressCollectionJob: Job, ) { state.startTransition(animation.contentTransition) // The transition is done. Cancel the collection in case the transition was finished // because it was interrupted by another transition. if (progressCollectionJob.isActive) { progressCollectionJob.cancel() } }