mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Slide in country picker vertically in regV5.
This commit is contained in:
committed by
Alex Hart
parent
49abece92b
commit
d1400928ce
@@ -11,7 +11,9 @@ import androidx.compose.animation.core.tween
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
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.navigation3.runtime.NavKey
|
||||
import androidx.navigation3.scene.Scene
|
||||
@@ -26,18 +28,20 @@ object TransitionSpecs {
|
||||
* Screens slide in from the right and slide out from the left.
|
||||
*/
|
||||
object HorizontalSlide {
|
||||
private const val DURATION = 200
|
||||
|
||||
val transitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.() -> ContentTransform = {
|
||||
(
|
||||
slideInHorizontally(
|
||||
initialOffsetX = { it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeIn(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeIn(animationSpec = tween(DURATION))
|
||||
) togetherWith
|
||||
(
|
||||
slideOutHorizontally(
|
||||
targetOffsetX = { -it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeOut(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeOut(animationSpec = tween(DURATION))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,30 +49,61 @@ object TransitionSpecs {
|
||||
(
|
||||
slideInHorizontally(
|
||||
initialOffsetX = { -it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeIn(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeIn(animationSpec = tween(DURATION))
|
||||
) togetherWith
|
||||
(
|
||||
slideOutHorizontally(
|
||||
targetOffsetX = { it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeOut(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeOut(animationSpec = tween(DURATION))
|
||||
)
|
||||
}
|
||||
|
||||
val predictivePopTransitonSpec: AnimatedContentTransitionScope<Scene<NavKey>>.(@NavigationEvent.SwipeEdge Int) -> ContentTransform = {
|
||||
val predictivePopTransitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.(@NavigationEvent.SwipeEdge Int) -> ContentTransform = {
|
||||
(
|
||||
slideInHorizontally(
|
||||
initialOffsetX = { -it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeIn(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeIn(animationSpec = tween(DURATION))
|
||||
) togetherWith
|
||||
(
|
||||
slideOutHorizontally(
|
||||
targetOffsetX = { it },
|
||||
animationSpec = tween(200)
|
||||
) + fadeOut(animationSpec = tween(200))
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeOut(animationSpec = tween(DURATION))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Screens slide in from the bottom and slide out to the bottom, like a sheet.
|
||||
*/
|
||||
object VerticalSlide {
|
||||
private const val DURATION = 300
|
||||
|
||||
val transitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.() -> ContentTransform = {
|
||||
slideInVertically(
|
||||
initialOffsetY = { it },
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeIn(animationSpec = tween(DURATION)) togetherWith
|
||||
fadeOut(animationSpec = tween(DURATION))
|
||||
}
|
||||
|
||||
val popTransitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.() -> ContentTransform = {
|
||||
fadeIn(animationSpec = tween(DURATION)) togetherWith
|
||||
slideOutVertically(
|
||||
targetOffsetY = { it },
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeOut(animationSpec = tween(DURATION))
|
||||
}
|
||||
|
||||
val predictivePopTransitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.(@NavigationEvent.SwipeEdge Int) -> ContentTransform = {
|
||||
fadeIn(animationSpec = tween(DURATION)) togetherWith
|
||||
slideOutVertically(
|
||||
targetOffsetY = { it },
|
||||
animationSpec = tween(DURATION)
|
||||
) + fadeOut(animationSpec = tween(DURATION))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user