Change SuccessView to LoadingView

This commit is contained in:
Wolf-Martell Montwé 2024-01-26 13:26:15 +01:00
parent 3b215d39be
commit bd6fa35997
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
2 changed files with 2 additions and 53 deletions

View file

@ -1,29 +1,19 @@
package app.k9mail.feature.account.setup.ui.specialfolders
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
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.platform.testTag
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.atom.Icon
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
import app.k9mail.core.ui.compose.designsystem.molecule.ContentLoadingErrorView
import app.k9mail.core.ui.compose.designsystem.molecule.ErrorView
import app.k9mail.core.ui.compose.designsystem.molecule.LoadingView
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer
import app.k9mail.core.ui.compose.theme.Icons
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.feature.account.common.ui.AppTitleTopHeader
@ -66,9 +56,9 @@ fun SpecialFoldersContent(
modifier = Modifier.fillMaxSize(),
) {
if (state.isSuccess) {
SuccessView(
LoadingView(
message = stringResource(id = R.string.account_setup_special_folders_success_message),
onEditClick = { onEvent(Event.OnEditClicked) },
modifier = Modifier.padding(horizontal = MainTheme.spacings.double),
)
} else {
SpecialFoldersFormContent(
@ -82,46 +72,6 @@ fun SpecialFoldersContent(
}
}
@Composable
fun SuccessView(
message: String,
onEditClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(MainTheme.spacings.double)
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
) {
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)
Row(
modifier = Modifier.height(MainTheme.sizes.larger),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Outlined.celebration,
tint = MainTheme.colors.secondary,
modifier = Modifier.requiredSize(MainTheme.sizes.large),
)
}
Row(
verticalAlignment = Alignment.CenterVertically,
) {
ButtonText(
text = stringResource(id = R.string.account_setup_special_folders_edit_folders_button_label),
onClick = onEditClick,
)
}
}
}
@Composable
private fun SpecialFoldersErrorView(
failure: SpecialFoldersContract.Failure,

View file

@ -39,7 +39,6 @@
<string name="account_setup_special_folders_trash_folder_label">Trash folder</string>
<string name="account_setup_special_folders_folder_none">None</string>
<string name="account_setup_special_folders_folder_automatic">Automatic (%s)</string>
<string name="account_setup_special_folders_edit_folders_button_label">Edit special folders</string>
<string name="account_setup_options_top_bar_title">Account options</string>
<string name="account_setup_options_section_display_options">Display options</string>