Skip to content

Commit

Permalink
animation changed
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Mar 1, 2023
1 parent edf7575 commit 4895940
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import dev.olshevski.navigation.reimagined.AnimatedNavHost
import dev.olshevski.navigation.reimagined.navigate
import dev.olshevski.navigation.reimagined.popUpTo
import dev.olshevski.navigation.reimagined.*
import ru.tech.imageresizershrinker.ImageResizerTheme
import ru.tech.imageresizershrinker.R
import ru.tech.imageresizershrinker.batch_resize.BatchResizeScreen
Expand Down Expand Up @@ -65,7 +63,16 @@ class MainActivity : ComponentActivity() {
BackHandler { showExitDialog = true }

Surface(Modifier.fillMaxSize()) {
AnimatedNavHost(controller = viewModel.navController) { screen ->
AnimatedNavHost(
controller = viewModel.navController,
transitionSpec = { action, from, to ->
if (to != Screen.Main) {
slideInVertically() + fadeIn() with fadeOut()
} else {
fadeIn() with fadeOut() + slideOutVertically()
}
}
) { screen ->
when (screen) {
is Screen.Main -> {
MainScreen(viewModel.navController)
Expand Down

0 comments on commit 4895940

Please sign in to comment.