From cbff31493539919ea9cea9da71b9890d7f21a2e1 Mon Sep 17 00:00:00 2001 From: Ash <83780687+ashnohe@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:11:59 -0800 Subject: [PATCH] add back in predictive back animations (#118) * add back in predictive back animations * spotless apply --- .../com/google/android/samples/socialite/ui/Main.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt b/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt index 52c8c3b6..e25a81de 100644 --- a/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt +++ b/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt @@ -20,14 +20,17 @@ import android.app.Activity import android.content.Intent import android.content.pm.ActivityInfo import android.os.Bundle +import androidx.compose.animation.EnterTransition import androidx.compose.animation.core.FastOutLinearInEasing import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut +import androidx.compose.animation.scaleOut import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.platform.LocalContext import androidx.navigation.NavController import androidx.navigation.NavDestination @@ -88,6 +91,15 @@ fun MainNavigation( NavHost( navController = navController, startDestination = Route.ChatsList, + popExitTransition = { + scaleOut( + targetScale = 0.9f, + transformOrigin = TransformOrigin(pivotFractionX = 0.5f, pivotFractionY = 0.5f), + ) + }, + popEnterTransition = { + EnterTransition.None + }, ) { composable { ChatList(