mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 18:36:37 +02:00
Adds sliding animations in all inner screens
This commit is contained in:
@@ -26,6 +26,10 @@ import android.content.Intent
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.scaleIn
|
||||||
|
import androidx.compose.animation.scaleOut
|
||||||
|
import androidx.compose.animation.slideInHorizontally
|
||||||
|
import androidx.compose.animation.slideOutHorizontally
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@@ -120,13 +124,37 @@ fun AppNavigation(
|
|||||||
|
|
||||||
composable(Route.Search.route) { SearchScreen(accountViewModel, nav) }
|
composable(Route.Search.route) { SearchScreen(accountViewModel, nav) }
|
||||||
|
|
||||||
composable(Route.BlockedUsers.route, content = { SecurityFiltersScreen(accountViewModel, nav) })
|
composable(
|
||||||
composable(Route.Bookmarks.route, content = { BookmarkListScreen(accountViewModel, nav) })
|
Route.BlockedUsers.route,
|
||||||
composable(Route.Drafts.route, content = { DraftListScreen(accountViewModel, nav) })
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
|
) { SecurityFiltersScreen(accountViewModel, nav) }
|
||||||
|
|
||||||
|
composable(
|
||||||
|
Route.Bookmarks.route,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
|
) { BookmarkListScreen(accountViewModel, nav) }
|
||||||
|
|
||||||
|
composable(
|
||||||
|
Route.Drafts.route,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
|
) { DraftListScreen(accountViewModel, nav) }
|
||||||
|
|
||||||
composable(
|
composable(
|
||||||
Route.ContentDiscovery.route,
|
Route.ContentDiscovery.route,
|
||||||
Route.ContentDiscovery.arguments,
|
Route.ContentDiscovery.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
DvmContentDiscoveryScreen(it.id(), accountViewModel, nav)
|
DvmContentDiscoveryScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -134,6 +162,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Profile.route,
|
Route.Profile.route,
|
||||||
Route.Profile.arguments,
|
Route.Profile.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
ProfileScreen(it.id(), accountViewModel, nav)
|
ProfileScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -141,6 +173,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Note.route,
|
Route.Note.route,
|
||||||
Route.Note.arguments,
|
Route.Note.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
ThreadScreen(it.id(), accountViewModel, nav)
|
ThreadScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -148,6 +184,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Hashtag.route,
|
Route.Hashtag.route,
|
||||||
Route.Hashtag.arguments,
|
Route.Hashtag.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
HashtagScreen(it.id(), accountViewModel, nav)
|
HashtagScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -155,6 +195,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Geohash.route,
|
Route.Geohash.route,
|
||||||
Route.Geohash.arguments,
|
Route.Geohash.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
GeoHashScreen(it.id(), accountViewModel, nav)
|
GeoHashScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -162,6 +206,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Community.route,
|
Route.Community.route,
|
||||||
Route.Community.arguments,
|
Route.Community.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
CommunityScreen(it.id(), accountViewModel, nav)
|
CommunityScreen(it.id(), accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -169,6 +217,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Room.route,
|
Route.Room.route,
|
||||||
Route.Room.arguments,
|
Route.Room.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
ChatroomScreen(
|
ChatroomScreen(
|
||||||
roomId = it.id(),
|
roomId = it.id(),
|
||||||
@@ -181,6 +233,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.RoomByAuthor.route,
|
Route.RoomByAuthor.route,
|
||||||
Route.RoomByAuthor.arguments,
|
Route.RoomByAuthor.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
ChatroomScreenByAuthor(it.id(), null, accountViewModel, nav)
|
ChatroomScreenByAuthor(it.id(), null, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
@@ -188,6 +244,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Channel.route,
|
Route.Channel.route,
|
||||||
Route.Channel.arguments,
|
Route.Channel.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
ChannelScreen(
|
ChannelScreen(
|
||||||
channelId = it.id(),
|
channelId = it.id(),
|
||||||
@@ -210,6 +270,10 @@ fun AppNavigation(
|
|||||||
composable(
|
composable(
|
||||||
Route.Settings.route,
|
Route.Settings.route,
|
||||||
Route.Settings.arguments,
|
Route.Settings.arguments,
|
||||||
|
enterTransition = { slideInHorizontallyFromEnd },
|
||||||
|
exitTransition = { scaleOut },
|
||||||
|
popEnterTransition = { scaleIn },
|
||||||
|
popExitTransition = { slideOutHorizontallyToEnd },
|
||||||
) {
|
) {
|
||||||
SettingsScreen(
|
SettingsScreen(
|
||||||
sharedPreferencesViewModel,
|
sharedPreferencesViewModel,
|
||||||
@@ -328,3 +392,9 @@ private fun isSameRoute(
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val slideInHorizontallyFromEnd = slideInHorizontally(animationSpec = tween(), initialOffsetX = { it })
|
||||||
|
val slideOutHorizontallyToEnd = slideOutHorizontally(animationSpec = tween(), targetOffsetX = { it })
|
||||||
|
|
||||||
|
val scaleIn = scaleIn(animationSpec = tween(), initialScale = 0.9f)
|
||||||
|
val scaleOut = scaleOut(animationSpec = tween(), targetScale = 0.9f)
|
||||||
|
Reference in New Issue
Block a user