Change transition betweens screen. skip login is unneeded.
This commit is contained in:
parent
4ede938017
commit
e9cb8cd0ac
7 changed files with 72 additions and 35 deletions
|
|
@ -1,14 +1,18 @@
|
|||
package com.pixelized.biblib.ui.composable.screen
|
||||
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.sharp.ArrowBack
|
||||
import androidx.compose.material.icons.sharp.LocalLibrary
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.pixelized.biblib.R
|
||||
import com.pixelized.biblib.ui.composable.pages.DetailPageComposable
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ fun SplashScreenComposable(
|
|||
val duration = 1000
|
||||
val typography = MaterialTheme.typography
|
||||
initialisation.LoadApplication {
|
||||
val visible = it !is IInitialisation.State.Finished
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
|
|
@ -53,7 +55,7 @@ fun SplashScreenComposable(
|
|||
.align(Alignment.Center)
|
||||
) {
|
||||
AnimatedVisibility(
|
||||
visible = it != IInitialisation.State.Finished,
|
||||
visible = visible,
|
||||
initiallyVisible = false,
|
||||
enter = fadeIn(animationSpec = tween(duration))
|
||||
+ slideInVertically(
|
||||
|
|
@ -73,7 +75,7 @@ fun SplashScreenComposable(
|
|||
}
|
||||
AnimatedVisibility(
|
||||
modifier = Modifier.align(Alignment.End),
|
||||
visible = it != IInitialisation.State.Finished,
|
||||
visible = visible,
|
||||
initiallyVisible = false,
|
||||
enter = fadeIn(animationSpec = tween(duration))
|
||||
+ slideInVertically(
|
||||
|
|
@ -95,7 +97,7 @@ fun SplashScreenComposable(
|
|||
|
||||
AnimatedVisibility(
|
||||
modifier = Modifier.align(Alignment.BottomEnd),
|
||||
visible = it != IInitialisation.State.Finished,
|
||||
visible = visible,
|
||||
enter = fadeIn(animationSpec = tween(duration)),
|
||||
exit = fadeOut(animationSpec = tween(duration)),
|
||||
) {
|
||||
|
|
@ -111,10 +113,14 @@ fun SplashScreenComposable(
|
|||
}
|
||||
}
|
||||
|
||||
if (it == IInitialisation.State.Finished) {
|
||||
LaunchedEffect(key1 = "navigateTo(INavigation.Screen.LoginScreen)") {
|
||||
if (it is IInitialisation.State.Finished) {
|
||||
LaunchedEffect(key1 = "SplashScreen.navigateTo()") {
|
||||
delay(1000)
|
||||
navigation.navigateTo(INavigation.Screen.LoginScreen)
|
||||
if (it.needLogin) {
|
||||
navigation.navigateTo(INavigation.Screen.LoginScreen)
|
||||
} else {
|
||||
navigation.navigateTo(INavigation.Screen.MainScreen)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue