diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/AboutNavigation.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/AboutNavigation.kt index 0675308..6b39a4c 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/AboutNavigation.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/AboutNavigation.kt @@ -20,11 +20,11 @@ fun NavGraphBuilder.aboutScreen( composable( route = ABOUT_ROUTE, enterTransition = { - slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth }) + slideInHorizontally { it } }, popEnterTransition = null, popExitTransition = { - slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth }) + slideOutHorizontally { it } } ) { AboutRoute( diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/LibrariesNavigation.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/LibrariesNavigation.kt index a8e4503..588233f 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/LibrariesNavigation.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/LibrariesNavigation.kt @@ -19,11 +19,11 @@ fun NavGraphBuilder.librariesScreen( composable( route = LIBRARIES_ROUTE, enterTransition = { - slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth }) + slideInHorizontally { it } }, popEnterTransition = null, popExitTransition = { - slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth }) + slideOutHorizontally { it } } ) { LibrariesRoute(onBackClick = onBackClick) diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/StarNavigation.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/StarNavigation.kt index b6ae10b..2dc39e6 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/StarNavigation.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/StarNavigation.kt @@ -25,8 +25,8 @@ fun NavGraphBuilder.starScreen( enterTransition = { when (initialState.destination.route) { TOOL_STORE_ROUTE, TOOLS_ROUTE -> - if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth }) - else slideInVertically(initialOffsetY = { fullHeight -> fullHeight }) + if (isVertical) slideInHorizontally { it } + else slideInVertically { it } else -> null } @@ -34,8 +34,8 @@ fun NavGraphBuilder.starScreen( exitTransition = { when (targetState.destination.route) { TOOL_STORE_ROUTE, TOOLS_ROUTE -> - if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth }) - else slideOutVertically(targetOffsetY = { fullHeight -> fullHeight }) + if (isVertical) slideOutHorizontally { it } + else slideOutVertically { it } else -> null } diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolStoreNavigation.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolStoreNavigation.kt index 1043c65..e2e954f 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolStoreNavigation.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolStoreNavigation.kt @@ -26,8 +26,8 @@ fun NavGraphBuilder.toolStoreScreen( enterTransition = { when (initialState.destination.route) { TOOLS_ROUTE, STAR_ROUTE -> - if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> -fullWidth }) - else slideInVertically(initialOffsetY = { fullHeight -> -fullHeight }) + if (isVertical) slideInHorizontally { -it } + else slideInVertically { -it } else -> null } @@ -35,8 +35,8 @@ fun NavGraphBuilder.toolStoreScreen( exitTransition = { when (targetState.destination.route) { TOOLS_ROUTE, STAR_ROUTE -> - if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> -fullWidth }) - else slideOutVertically(targetOffsetY = { fullHeight -> -fullHeight }) + if (isVertical) slideOutHorizontally { -it } + else slideOutVertically { -it } else -> null } diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolsNavigation.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolsNavigation.kt index bda698d..17c4a3b 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolsNavigation.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/navigation/ToolsNavigation.kt @@ -27,12 +27,12 @@ fun NavGraphBuilder.toolsScreen( enterTransition = { when (initialState.destination.route) { TOOL_STORE_ROUTE -> - if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth }) - else slideInVertically(initialOffsetY = { fullHeight -> fullHeight }) + if (isVertical) slideInHorizontally { it } + else slideInVertically { it } STAR_ROUTE -> - if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> -fullWidth }) - else slideInVertically(initialOffsetY = { fullHeight -> -fullHeight }) + if (isVertical) slideInHorizontally { -it } + else slideInVertically { -it } else -> null } @@ -40,12 +40,12 @@ fun NavGraphBuilder.toolsScreen( exitTransition = { when (targetState.destination.route) { TOOL_STORE_ROUTE -> - if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth }) - else slideOutVertically(targetOffsetY = { fullHeight -> fullHeight }) + if (isVertical) slideOutHorizontally { it } + else slideOutVertically { it } STAR_ROUTE -> - if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> -fullWidth }) - else slideOutVertically(targetOffsetY = { fullHeight -> -fullHeight }) + if (isVertical) slideOutHorizontally { -it } + else slideOutVertically { -it } else -> null } diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/ui/OxygenApp.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/ui/OxygenApp.kt index a59a4fc..99e6170 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/ui/OxygenApp.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/ui/OxygenApp.kt @@ -1,7 +1,6 @@ package top.fatweb.oxygen.toolbox.ui import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.slideInVertically import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets @@ -128,8 +127,8 @@ fun OxygenApp(appState: OxygenAppState) { snackbarHost = { SnackbarHost(hostState = snackbarHostState) }, bottomBar = { AnimatedVisibility( - visible = appState.shouldShowBottomBar && destination != null, - enter = slideInVertically { it }) { + visible = appState.shouldShowBottomBar && destination != null + ) { BottomAppBar( windowInsets = WindowInsets(0) ) { @@ -153,7 +152,9 @@ fun OxygenApp(appState: OxygenAppState) { ) ) ) { - AnimatedVisibility(visible = appState.shouldShowNavRail && destination != null) { + AnimatedVisibility( + visible = appState.shouldShowNavRail && destination != null + ) { OxygenNavRail( modifier = Modifier.safeDrawingPadding(), destinations = appState.topLevelDestinations, @@ -165,11 +166,13 @@ fun OxygenApp(appState: OxygenAppState) { Column( Modifier.fillMaxSize() ) { - if (destination != null) { + AnimatedVisibility( + visible = destination != null + ) { OxygenTopAppBar( scrollBehavior = topAppBarScrollBehavior, title = { - Text(text = stringResource(destination.titleTextId)) + destination?.let { Text(text = stringResource(destination.titleTextId)) } }, navigationIcon = OxygenIcons.Search, navigationIconContentDescription = stringResource(R.string.feature_settings_top_app_bar_navigation_icon_description),