Dialog annimation
This commit is contained in:
parent
f3b11e30c5
commit
9591b4239c
5 changed files with 31 additions and 16 deletions
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -120,7 +120,9 @@
|
||||||
<entry key="../../../../../layout/compose-model-1620500516060.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620500516060.xml" value="0.5818181818181818" />
|
||||||
<entry key="../../../../../layout/compose-model-1620500563383.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620500563383.xml" value="0.5818181818181818" />
|
||||||
<entry key="../../../../../layout/compose-model-1620500952241.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620500952241.xml" value="0.5818181818181818" />
|
||||||
|
<entry key="../../../../../layout/compose-model-1620501296867.xml" value="0.25" />
|
||||||
<entry key="../../../../../layout/compose-model-1620501296868.xml" value="0.1" />
|
<entry key="../../../../../layout/compose-model-1620501296868.xml" value="0.1" />
|
||||||
|
<entry key="../../../../../layout/compose-model-1620503104619.xml" value="0.5818181818181818" />
|
||||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2898148148148148" />
|
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2898148148148148" />
|
||||||
<entry key="app/src/main/res/drawable/ic_baseline_local_library_24.xml" value="0.25462962962962965" />
|
<entry key="app/src/main/res/drawable/ic_baseline_local_library_24.xml" value="0.25462962962962965" />
|
||||||
<entry key="app/src/main/res/drawable/ic_google.xml" value="0.2962962962962963" />
|
<entry key="app/src/main/res/drawable/ic_google.xml" value="0.2962962962962963" />
|
||||||
|
|
|
||||||
|
|
@ -31,15 +31,15 @@ fun ErrorCard(
|
||||||
Card(elevation = 8.dp, modifier = modifier) {
|
Card(elevation = 8.dp, modifier = modifier) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(200.dp)
|
.width(250.dp)
|
||||||
.padding(16.dp)
|
.padding(32.dp)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(72.dp)
|
.width(64.dp)
|
||||||
.height(72.dp)
|
.height(64.dp)
|
||||||
.align(Alignment.CenterHorizontally)
|
.align(Alignment.CenterHorizontally)
|
||||||
.padding(16.dp),
|
.padding(bottom = 16.dp),
|
||||||
tint = MaterialTheme.colors.error,
|
tint = MaterialTheme.colors.error,
|
||||||
imageVector = Icons.Sharp.ErrorOutline,
|
imageVector = Icons.Sharp.ErrorOutline,
|
||||||
contentDescription = "error"
|
contentDescription = "error"
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ fun LoadingCard(
|
||||||
Card(elevation = 8.dp, modifier = modifier) {
|
Card(elevation = 8.dp, modifier = modifier) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(200.dp)
|
.width(250.dp)
|
||||||
.padding(16.dp)
|
.padding(32.dp)
|
||||||
) {
|
) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterHorizontally)
|
.align(Alignment.CenterHorizontally)
|
||||||
.padding(16.dp)
|
.padding(bottom = 16.dp)
|
||||||
)
|
)
|
||||||
if (message?.isNotEmpty() == true) {
|
if (message?.isNotEmpty() == true) {
|
||||||
val typography = MaterialTheme.typography
|
val typography = MaterialTheme.typography
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.pixelized.biblib.ui.composable.screen
|
package com.pixelized.biblib.ui.composable.screen
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
|
import androidx.compose.animation.expandVertically
|
||||||
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
|
|
@ -145,6 +149,7 @@ private fun LoginScreenContentComposable(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalAnimationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun LoginScreenDialogComposable(
|
private fun LoginScreenDialogComposable(
|
||||||
authentication: IAuthentication
|
authentication: IAuthentication
|
||||||
|
|
@ -158,18 +163,26 @@ private fun LoginScreenDialogComposable(
|
||||||
},
|
},
|
||||||
visible = (state.value is IAuthentication.State.Initial).not()
|
visible = (state.value is IAuthentication.State.Initial).not()
|
||||||
) {
|
) {
|
||||||
when (val currentState = state.value) {
|
AnimatedVisibility(
|
||||||
is IAuthentication.State.Error -> ErrorCard(
|
|
||||||
modifier = Modifier.align(Alignment.Center),
|
modifier = Modifier.align(Alignment.Center),
|
||||||
|
visible = state.value is IAuthentication.State.Error,
|
||||||
|
enter = expandVertically(Alignment.CenterVertically),
|
||||||
|
exit = shrinkVertically(Alignment.CenterVertically),
|
||||||
|
) {
|
||||||
|
ErrorCard(
|
||||||
message = stringResource(id = R.string.error_generic),
|
message = stringResource(id = R.string.error_generic),
|
||||||
exception = currentState.exception
|
exception = (state.value as? IAuthentication.State.Error)?.exception
|
||||||
)
|
)
|
||||||
is IAuthentication.State.Connect,
|
}
|
||||||
is IAuthentication.State.Loading -> LoadingCard(
|
AnimatedVisibility(
|
||||||
modifier = Modifier.align(Alignment.Center),
|
modifier = Modifier.align(Alignment.Center),
|
||||||
|
visible = state.value is IAuthentication.State.Loading || state.value is IAuthentication.State.Connect,
|
||||||
|
enter = expandVertically(Alignment.CenterVertically),
|
||||||
|
exit = shrinkVertically(Alignment.CenterVertically),
|
||||||
|
) {
|
||||||
|
LoadingCard(
|
||||||
message = stringResource(id = R.string.loading)
|
message = stringResource(id = R.string.loading)
|
||||||
)
|
)
|
||||||
else -> Box {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue