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

Commit 70131389 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Correct the RTL animation for AnimatedNavHost"

parents 96753d9f bb5bcefa
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -119,22 +119,22 @@ private fun NavControllerWrapperImpl.NavContent(allProvider: Collection<Settings
                arguments = spp.parameter,
                enterTransition = {
                    slideIntoContainer(
                        AnimatedContentScope.SlideDirection.Left, animationSpec = slideEffect
                        AnimatedContentScope.SlideDirection.Start, animationSpec = slideEffect
                    ) + fadeIn(animationSpec = fadeEffect)
                },
                exitTransition = {
                    slideOutOfContainer(
                        AnimatedContentScope.SlideDirection.Left, animationSpec = slideEffect
                        AnimatedContentScope.SlideDirection.Start, animationSpec = slideEffect
                    ) + fadeOut(animationSpec = fadeEffect)
                },
                popEnterTransition = {
                    slideIntoContainer(
                        AnimatedContentScope.SlideDirection.Right, animationSpec = slideEffect
                        AnimatedContentScope.SlideDirection.End, animationSpec = slideEffect
                    ) + fadeIn(animationSpec = fadeEffect)
                },
                popExitTransition = {
                    slideOutOfContainer(
                        AnimatedContentScope.SlideDirection.Right, animationSpec = slideEffect
                        AnimatedContentScope.SlideDirection.End, animationSpec = slideEffect
                    ) + fadeOut(animationSpec = fadeEffect)
                },
            ) { navBackStackEntry ->
+1 −5
Original line number Diff line number Diff line
@@ -201,11 +201,7 @@ public fun AnimatedNavHost(
        transition.AnimatedContent(
            modifier,
            transitionSpec = {
                val zIndex = if (composeNavigator.isPop.value) {
                    visibleEntries.indexOf(initialState).toFloat()
                } else {
                    visibleEntries.indexOf(targetState).toFloat()
                }
                val zIndex = composeNavigator.backStack.value.size.toFloat()
                // If the initialState of the AnimatedContent is not in visibleEntries, we are in
                // a case where visible has cleared the old state for some reason, so instead of
                // attempting to animate away from the initialState, we skip the animation.