Skip to content

Commit

Permalink
feat(main): use slide transitions for some screens.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed May 9, 2024
1 parent 72923df commit f30452e
Showing 1 changed file with 79 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
package org.gdglille.devfest.android.theme

import android.content.res.Configuration
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.EaseIn
import androidx.compose.animation.core.EaseOut
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.material3.Icon
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
Expand Down Expand Up @@ -154,6 +163,8 @@ fun MainNavigation(
NavHost(
navController = navController,
startDestination = startDestination,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
builder = {
composable(route = Screen.EventList.route) {
EventListVM(
Expand Down Expand Up @@ -191,7 +202,23 @@ fun MainNavigation(
navDeepLink {
uriPattern = "$rootUri/${Screen.Schedule.route}"
}
)
),
enterTransition = {
fadeIn(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideIntoContainer(
animationSpec = tween(durationMillis = 300, easing = EaseIn),
towards = AnimatedContentTransitionScope.SlideDirection.Start
)
},
exitTransition = {
fadeOut(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideOutOfContainer(
animationSpec = tween(durationMillis = 300, easing = EaseOut),
towards = AnimatedContentTransitionScope.SlideDirection.End
)
}
) {
ScheduleDetailOrientableVM(
scheduleId = it.arguments?.getString("scheduleId")!!,
Expand All @@ -203,7 +230,23 @@ fun MainNavigation(
}
composable(
route = Screen.ScheduleEvent.route,
arguments = listOf(navArgument("scheduleId") { type = NavType.StringType })
arguments = listOf(navArgument("scheduleId") { type = NavType.StringType }),
enterTransition = {
fadeIn(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideIntoContainer(
animationSpec = tween(durationMillis = 300, easing = EaseIn),
towards = AnimatedContentTransitionScope.SlideDirection.Start
)
},
exitTransition = {
fadeOut(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideOutOfContainer(
animationSpec = tween(durationMillis = 300, easing = EaseOut),
towards = AnimatedContentTransitionScope.SlideDirection.End
)
}
) {
ScheduleDetailEventSessionVM(
scheduleId = it.arguments?.getString("scheduleId")!!,
Expand All @@ -219,7 +262,23 @@ fun MainNavigation(
}
composable(
route = Screen.Speaker.route,
arguments = listOf(navArgument("speakerId") { type = NavType.StringType })
arguments = listOf(navArgument("speakerId") { type = NavType.StringType }),
enterTransition = {
fadeIn(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideIntoContainer(
animationSpec = tween(durationMillis = 300, easing = EaseIn),
towards = AnimatedContentTransitionScope.SlideDirection.Start
)
},
exitTransition = {
fadeOut(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideOutOfContainer(
animationSpec = tween(durationMillis = 300, easing = EaseOut),
towards = AnimatedContentTransitionScope.SlideDirection.End
)
}
) {
SpeakerDetailVM(
speakerId = it.arguments?.getString("speakerId")!!,
Expand Down Expand Up @@ -273,7 +332,23 @@ fun MainNavigation(
navDeepLink {
uriPattern = "$rootUri/${Screen.Partner.route}"
}
)
),
enterTransition = {
fadeIn(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideIntoContainer(
animationSpec = tween(durationMillis = 300, easing = EaseIn),
towards = AnimatedContentTransitionScope.SlideDirection.Start
)
},
exitTransition = {
fadeOut(
animationSpec = tween(durationMillis = 300, easing = LinearEasing)
) + slideOutOfContainer(
animationSpec = tween(durationMillis = 300, easing = EaseOut),
towards = AnimatedContentTransitionScope.SlideDirection.End
)
}
) {
PartnerDetailVM(
partnerId = it.arguments?.getString("partnerId")!!,
Expand Down

0 comments on commit f30452e

Please sign in to comment.