Change account setup special folders feature to theme 2

This commit is contained in:
Wolf-Martell Montwé 2024-04-24 17:43:49 +02:00
parent 6de38fcc9e
commit b06c1c8985
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
9 changed files with 101 additions and 92 deletions

View file

@ -0,0 +1,64 @@
package app.k9mail.feature.account.setup.ui.specialfolders
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
@Composable
@Preview(showBackground = true)
internal fun SpecialFoldersContentLoadingPreview() {
PreviewWithTheme {
SpecialFoldersContent(
state = SpecialFoldersContract.State(
isLoading = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun SpecialFoldersContentFormPreview() {
PreviewWithTheme {
SpecialFoldersContent(
state = SpecialFoldersContract.State(
isLoading = false,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun SpecialFoldersContentSuccessPreview() {
PreviewWithTheme {
SpecialFoldersContent(
state = SpecialFoldersContract.State(
isLoading = false,
isSuccess = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun SpecialFoldersContentErrorPreview() {
PreviewWithTheme {
SpecialFoldersContent(
state = SpecialFoldersContract.State(
isLoading = false,
error = SpecialFoldersContract.Failure.LoadFoldersFailed("Error"),
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}

View file

@ -0,0 +1,16 @@
package app.k9mail.feature.account.setup.ui.specialfolders
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
@Composable
@Preview(showBackground = true)
internal fun SpecialFoldersFormContentPreview() {
PreviewWithTheme {
SpecialFoldersFormContent(
state = SpecialFoldersContract.FormState(),
onEvent = {},
)
}
}

View file

@ -0,0 +1,18 @@
package app.k9mail.feature.account.setup.ui.specialfolders
import androidx.compose.runtime.Composable
import app.k9mail.core.ui.compose.common.annotation.PreviewDevices
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersViewModel
@Composable
@PreviewDevices
internal fun SpecialFoldersScreenPreview() {
PreviewWithTheme {
SpecialFoldersScreen(
onNext = {},
onBack = {},
viewModel = FakeSpecialFoldersViewModel(),
)
}
}

View file

@ -9,13 +9,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.molecule.ContentLoadingErrorView 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.ErrorView
import app.k9mail.core.ui.compose.designsystem.molecule.LoadingView import app.k9mail.core.ui.compose.designsystem.molecule.LoadingView
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer
import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.feature.account.common.ui.AppTitleTopHeader import app.k9mail.feature.account.common.ui.AppTitleTopHeader
import app.k9mail.feature.account.common.ui.loadingerror.rememberContentLoadingErrorViewState import app.k9mail.feature.account.common.ui.loadingerror.rememberContentLoadingErrorViewState
import app.k9mail.feature.account.setup.R import app.k9mail.feature.account.setup.R
@ -94,61 +92,3 @@ private fun SpecialFoldersErrorView(
.padding(MainTheme.spacings.double), .padding(MainTheme.spacings.double),
) )
} }
@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentLoadingPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentFormPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentSuccessPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
isSuccess = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}
@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentErrorPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
error = SpecialFoldersContract.Failure.LoadFoldersFailed("Error"),
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}

View file

@ -11,12 +11,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyLarge import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyLarge
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall
import app.k9mail.core.ui.compose.designsystem.molecule.input.SelectInput import app.k9mail.core.ui.compose.designsystem.molecule.input.SelectInput
import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.feature.account.common.ui.item.defaultItemPadding import app.k9mail.feature.account.common.ui.item.defaultItemPadding
import app.k9mail.feature.account.setup.R import app.k9mail.feature.account.setup.R
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent
@ -113,14 +111,3 @@ fun SpecialFoldersFormContent(
} }
} }
} }
@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersFormContentPreview() {
PreviewWithThemes {
SpecialFoldersFormContent(
state = FormState(),
onEvent = {},
)
}
}

View file

@ -4,16 +4,13 @@ import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import app.k9mail.core.ui.compose.common.annotation.PreviewDevices
import app.k9mail.core.ui.compose.common.mvi.observe import app.k9mail.core.ui.compose.common.mvi.observe
import app.k9mail.core.ui.compose.designsystem.template.Scaffold import app.k9mail.core.ui.compose.designsystem.template.Scaffold
import app.k9mail.core.ui.compose.theme.K9Theme
import app.k9mail.feature.account.common.ui.WizardNavigationBar import app.k9mail.feature.account.common.ui.WizardNavigationBar
import app.k9mail.feature.account.common.ui.WizardNavigationBarState import app.k9mail.feature.account.common.ui.WizardNavigationBarState
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Effect import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Effect
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Event import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Event
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.ViewModel import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.ViewModel
import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersViewModel
@Composable @Composable
fun SpecialFoldersScreen( fun SpecialFoldersScreen(
@ -56,15 +53,3 @@ fun SpecialFoldersScreen(
) )
} }
} }
@Composable
@PreviewDevices
internal fun SpecialFoldersScreenK9Preview() {
K9Theme {
SpecialFoldersScreen(
onNext = {},
onBack = {},
viewModel = FakeSpecialFoldersViewModel(),
)
}
}

View file

@ -1,4 +1,4 @@
package app.k9mail.feature.account.setup.ui.specialfolders.fake package app.k9mail.feature.account.setup.ui.specialfolders
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState

View file

@ -17,7 +17,6 @@ import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.State import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.State
import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersFormUiModel
import assertk.assertThat import assertk.assertThat
import assertk.assertions.containsExactly import assertk.assertions.containsExactly
import assertk.assertions.isEqualTo import assertk.assertions.isEqualTo