diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 10f80933..0d903bee 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,4 +1,3 @@ -import com.github.triplet.gradle.androidpublisher.ReleaseStatus import java.util.Properties plugins { @@ -67,7 +66,10 @@ android { targetCompatibility = javaVersion } - buildFeatures { compose = true } + buildFeatures { + compose = true + buildConfig = true + } packaging { resources { @@ -91,7 +93,6 @@ dependencies { debugImplementation(libs.compose.ui.tooling) } - play { // The play_config.json file will be provided on CI serviceAccountCredentials.set(file("../play_config.json")) diff --git a/shared/src/commonMain/kotlin/com/prof18/moneyflow/navigation/MoneyFlowNavHost.kt b/shared/src/commonMain/kotlin/com/prof18/moneyflow/navigation/MoneyFlowNavHost.kt index 301b50e4..3ea56abc 100644 --- a/shared/src/commonMain/kotlin/com/prof18/moneyflow/navigation/MoneyFlowNavHost.kt +++ b/shared/src/commonMain/kotlin/com/prof18/moneyflow/navigation/MoneyFlowNavHost.kt @@ -1,5 +1,13 @@ package com.prof18.moneyflow.navigation +import androidx.compose.animation.EnterTransition +import androidx.compose.animation.ExitTransition +import androidx.compose.animation.core.tween +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideInVertically +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.animation.slideOutVertically +import androidx.compose.animation.togetherWith import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides @@ -61,6 +69,25 @@ import org.jetbrains.compose.resources.stringResource import org.koin.compose.koinInject import org.koin.compose.viewmodel.koinViewModel +private const val DEFAULT_ANIMATION_DURATION_MILLIS = 300 + +private fun bottomSheetForwardTransition() = + slideInVertically( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + initialOffsetY = { it }, + ) togetherWith ExitTransition.None + +private fun bottomSheetPopTransition() = + EnterTransition.None togetherWith slideOutVertically( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + targetOffsetY = { it }, + ) + +private val bottomSheetTransitionMetadata = + NavDisplay.transitionSpec { bottomSheetForwardTransition() } + + NavDisplay.popTransitionSpec { bottomSheetPopTransition() } + + NavDisplay.predictivePopTransitionSpec { _: Int -> bottomSheetPopTransition() } + @Composable fun MoneyFlowNavHost(modifier: Modifier = Modifier) { val backStack = rememberSerializable(serializer = SnapshotStateListSerializer(AppRoute.serializer())) { @@ -98,6 +125,33 @@ fun MoneyFlowNavHost(modifier: Modifier = Modifier) { rememberSaveableStateHolderNavEntryDecorator(), rememberViewModelStoreNavEntryDecorator(), ), + transitionSpec = { + slideInHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + initialOffsetX = { it }, + ) togetherWith slideOutHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + targetOffsetX = { -it }, + ) + }, + popTransitionSpec = { + slideInHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + initialOffsetX = { -it }, + ) togetherWith slideOutHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + targetOffsetX = { it }, + ) + }, + predictivePopTransitionSpec = { edge -> + slideInHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + initialOffsetX = { -it }, + ) togetherWith slideOutHorizontally( + animationSpec = tween(DEFAULT_ANIMATION_DURATION_MILLIS), + targetOffsetX = { it }, + ) + }, ) } } @@ -205,7 +259,7 @@ private fun EntryProviderScope.screens( ) } - entry { route -> + entry(metadata = bottomSheetTransitionMetadata) { route -> val viewModel = koinViewModel() val categoryModel by viewModel.categories.collectAsState() @@ -222,7 +276,7 @@ private fun EntryProviderScope.screens( ) } - entry { + entry(metadata = bottomSheetTransitionMetadata) { val viewModel = koinViewModel() AllTransactionsScreen( stateFlow = viewModel.state,