From e9fb4ecd57da26f772eedcdccc3a203af04a0369 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 26 Jan 2024 21:46:49 +0100 Subject: [PATCH] Center text in `LoadingView`, `SuccessView`, and `ErrorView` --- .../core/ui/compose/designsystem/molecule/ErrorView.kt | 2 ++ .../core/ui/compose/designsystem/molecule/LoadingView.kt | 6 +++++- .../k9mail/feature/account/common/ui/view/SuccessView.kt | 8 ++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/ErrorView.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/ErrorView.kt index 6bc8f2f09..e760439d8 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/ErrorView.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/ErrorView.kt @@ -13,6 +13,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.designsystem.R import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText @@ -54,6 +55,7 @@ fun ErrorView( ) TextSubtitle1( text = title, + textAlign = TextAlign.Center, ) } diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/LoadingView.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/LoadingView.kt index 57747732d..407de55b4 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/LoadingView.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/molecule/LoadingView.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.designsystem.atom.CircularProgressIndicator import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1 @@ -36,7 +37,10 @@ fun LoadingView( verticalArrangement = Arrangement.Center, ) { if (message != null) { - TextSubtitle1(text = message) + TextSubtitle1( + text = message, + textAlign = TextAlign.Center, + ) } Row( modifier = Modifier.height(MainTheme.sizes.larger), diff --git a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/view/SuccessView.kt b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/view/SuccessView.kt index a9bcee8b6..1f63f9dae 100644 --- a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/view/SuccessView.kt +++ b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/view/SuccessView.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.requiredSize import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.designsystem.atom.Icon import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1 @@ -28,7 +29,10 @@ fun SuccessView( .then(modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - TextSubtitle1(text = message) + TextSubtitle1( + text = message, + textAlign = TextAlign.Center, + ) Row( modifier = Modifier.height(MainTheme.sizes.larger), verticalAlignment = Alignment.CenterVertically, @@ -47,7 +51,7 @@ fun SuccessView( internal fun SuccessViewPreview() { PreviewWithThemes { SuccessView( - message = "Success", + message = "The app tried really hard and managed to successfully complete the operation.", ) } }