Force theme and colors in WaitListView.
This commit is contained in:
parent
e7de13a1bc
commit
182e0ebf97
1 changed files with 65 additions and 61 deletions
|
|
@ -29,7 +29,9 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.systemBarsPadding
|
import androidx.compose.foundation.layout.systemBarsPadding
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.BiasAbsoluteAlignment
|
import androidx.compose.ui.BiasAbsoluteAlignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -132,73 +134,75 @@ private fun WaitListContent(
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
ElementTheme(
|
||||||
modifier = modifier
|
darkTheme = true
|
||||||
.fillMaxSize()
|
|
||||||
.systemBarsPadding()
|
|
||||||
.padding(horizontal = 16.dp, vertical = 16.dp)
|
|
||||||
) {
|
) {
|
||||||
if (state.loginAction !is Async.Success) {
|
|
||||||
ElementTheme(darkTheme = true) {
|
|
||||||
TextButton(
|
|
||||||
text = stringResource(CommonStrings.action_cancel),
|
|
||||||
onClick = onCancelClicked,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = modifier
|
||||||
contentAlignment = BiasAbsoluteAlignment(
|
.fillMaxSize()
|
||||||
horizontalBias = 0f,
|
.systemBarsPadding()
|
||||||
verticalBias = -0.05f
|
.padding(horizontal = 16.dp, vertical = 16.dp)
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Column(
|
if (state.loginAction !is Async.Success) {
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
CompositionLocalProvider(LocalContentColor provides Color.Black) {
|
||||||
) {
|
TextButton(
|
||||||
if (state.loginAction.isLoading()) {
|
text = stringResource(CommonStrings.action_cancel),
|
||||||
CircularProgressIndicator(
|
onClick = onCancelClicked,
|
||||||
modifier = Modifier.size(24.dp),
|
|
||||||
strokeWidth = 2.dp,
|
|
||||||
color = Color.White
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
|
||||||
val titleRes = when (state.loginAction) {
|
|
||||||
is Async.Success -> R.string.screen_waitlist_title_success
|
|
||||||
else -> R.string.screen_waitlist_title
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
text = withColoredPeriod(titleRes),
|
|
||||||
style = ElementTheme.typography.fontHeadingXlBold,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
val subtitle = when (state.loginAction) {
|
|
||||||
is Async.Success -> stringResource(
|
|
||||||
id = R.string.screen_waitlist_message_success,
|
|
||||||
state.appName,
|
|
||||||
)
|
|
||||||
else -> stringResource(
|
|
||||||
id = R.string.screen_waitlist_message,
|
|
||||||
state.appName,
|
|
||||||
state.serverName,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
|
||||||
modifier = Modifier.widthIn(max = 360.dp),
|
|
||||||
text = subtitle,
|
|
||||||
style = ElementTheme.typography.fontBodyLgRegular,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
Box(
|
||||||
if (state.loginAction is Async.Success) {
|
modifier = Modifier.fillMaxSize(),
|
||||||
ElementTheme(darkTheme = true) {
|
contentAlignment = BiasAbsoluteAlignment(
|
||||||
|
horizontalBias = 0f,
|
||||||
|
verticalBias = -0.05f
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
if (state.loginAction.isLoading()) {
|
||||||
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
strokeWidth = 2.dp,
|
||||||
|
color = ElementTheme.colors.iconPrimary
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(18.dp))
|
||||||
|
val titleRes = when (state.loginAction) {
|
||||||
|
is Async.Success -> R.string.screen_waitlist_title_success
|
||||||
|
else -> R.string.screen_waitlist_title
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = withColoredPeriod(titleRes),
|
||||||
|
style = ElementTheme.typography.fontHeadingXlBold,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = ElementTheme.colors.textPrimary,
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
val subtitle = when (state.loginAction) {
|
||||||
|
is Async.Success -> stringResource(
|
||||||
|
id = R.string.screen_waitlist_message_success,
|
||||||
|
state.appName,
|
||||||
|
)
|
||||||
|
else -> stringResource(
|
||||||
|
id = R.string.screen_waitlist_message,
|
||||||
|
state.appName,
|
||||||
|
state.serverName,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.widthIn(max = 360.dp),
|
||||||
|
text = subtitle,
|
||||||
|
style = ElementTheme.typography.fontBodyLgRegular,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = Color.White,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state.loginAction is Async.Success) {
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = CommonStrings.action_continue),
|
text = stringResource(id = CommonStrings.action_continue),
|
||||||
onClick = { state.eventSink.invoke(WaitListEvents.Continue) },
|
onClick = { state.eventSink.invoke(WaitListEvents.Continue) },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue