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

Commit bb5bcefa authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Correct the RTL animation for AnimatedNavHost

Use Start & End to make sure this is also correct for RTL.

Also import changes from Accompanist.

Bug: 236346018
Test: Manually with Settings
Change-Id: I8ccfd685d6efdb517b4f50845bbec058d76b1636
parent cce2be38
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.