Add slide transitions
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
package it.vfsfitvnm.vimusic.ui.screens
|
package it.vfsfitvnm.vimusic.ui.screens
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.animation.AnimatedContentScope
|
|
||||||
import androidx.compose.animation.ExperimentalAnimationApi
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.animation.with
|
|
||||||
import androidx.compose.foundation.*
|
import androidx.compose.foundation.*
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
@@ -17,9 +15,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import it.vfsfitvnm.route.Route0
|
import it.vfsfitvnm.route.*
|
||||||
import it.vfsfitvnm.route.RouteHandler
|
|
||||||
import it.vfsfitvnm.route.fastFade
|
|
||||||
import it.vfsfitvnm.vimusic.R
|
import it.vfsfitvnm.vimusic.R
|
||||||
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
|
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
|
||||||
import it.vfsfitvnm.vimusic.ui.components.themed.EnumValueSelectorDialog
|
import it.vfsfitvnm.vimusic.ui.components.themed.EnumValueSelectorDialog
|
||||||
@@ -47,13 +43,9 @@ fun SettingsScreen() {
|
|||||||
listenToGlobalEmitter = true,
|
listenToGlobalEmitter = true,
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
when (targetState.route) {
|
when (targetState.route) {
|
||||||
appearanceRoute, backupAndRestoreRoute ->
|
appearanceRoute, backupAndRestoreRoute -> leftSlide
|
||||||
slideIntoContainer(AnimatedContentScope.SlideDirection.Left) with
|
|
||||||
slideOutOfContainer(AnimatedContentScope.SlideDirection.Left)
|
|
||||||
else -> when (initialState.route) {
|
else -> when (initialState.route) {
|
||||||
appearanceRoute, backupAndRestoreRoute ->
|
appearanceRoute, backupAndRestoreRoute -> rightSlide
|
||||||
slideIntoContainer(AnimatedContentScope.SlideDirection.Right) with
|
|
||||||
slideOutOfContainer(AnimatedContentScope.SlideDirection.Right)
|
|
||||||
else -> fastFade
|
else -> fastFade
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ import androidx.compose.animation.*
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
|
||||||
|
|
||||||
|
@ExperimentalAnimationApi
|
||||||
|
val AnimatedContentScope<RouteHandlerScope>.leftSlide: ContentTransform
|
||||||
|
get() = slideIntoContainer(AnimatedContentScope.SlideDirection.Left) with
|
||||||
|
slideOutOfContainer(AnimatedContentScope.SlideDirection.Left)
|
||||||
|
|
||||||
|
@ExperimentalAnimationApi
|
||||||
|
val AnimatedContentScope<RouteHandlerScope>.rightSlide: ContentTransform
|
||||||
|
get() = slideIntoContainer(AnimatedContentScope.SlideDirection.Right) with
|
||||||
|
slideOutOfContainer(AnimatedContentScope.SlideDirection.Right)
|
||||||
|
|
||||||
@ExperimentalAnimationApi
|
@ExperimentalAnimationApi
|
||||||
val AnimatedContentScope<RouteHandlerScope>.fastFade: ContentTransform
|
val AnimatedContentScope<RouteHandlerScope>.fastFade: ContentTransform
|
||||||
get() = fadeIn(tween(200)) with fadeOut(tween(200))
|
get() = fadeIn(tween(200)) with fadeOut(tween(200))
|
||||||
|
|||||||
Reference in New Issue
Block a user