From b65e214c977f71877b65b2c70bb19b5b9038f913 Mon Sep 17 00:00:00 2001 From: Ash Nohe Date: Thu, 12 Dec 2024 13:58:38 -0800 Subject: [PATCH 1/2] add back in predictive back animations --- .../google/android/samples/socialite/ui/Main.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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..4f23ca2d 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,7 +91,16 @@ 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( onChatClicked = { chatId -> navController.navigate(Route.ChatThread(chatId)) }, From 97e5692e528d56f64768d0cf1a5a035d122487c1 Mon Sep 17 00:00:00 2001 From: Ash Nohe Date: Thu, 12 Dec 2024 14:06:11 -0800 Subject: [PATCH 2/2] spotless apply --- .../java/com/google/android/samples/socialite/ui/Main.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 4f23ca2d..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 @@ -94,13 +94,13 @@ fun MainNavigation( popExitTransition = { scaleOut( targetScale = 0.9f, - transformOrigin = TransformOrigin(pivotFractionX=0.5f, pivotFractionY = 0.5f) + transformOrigin = TransformOrigin(pivotFractionX = 0.5f, pivotFractionY = 0.5f), ) }, popEnterTransition = { EnterTransition.None - } - ) { + }, + ) { composable { ChatList( onChatClicked = { chatId -> navController.navigate(Route.ChatThread(chatId)) },