Merge pull request #6858 from thundernest/add_account_setup_screens
Add account setup screens
This commit is contained in:
commit
0c4cc1ff33
23 changed files with 633 additions and 30 deletions
|
@ -16,4 +16,5 @@ dependencies {
|
|||
implementation(projects.core.ui.compose.designsystem)
|
||||
|
||||
implementation(projects.feature.onboarding)
|
||||
implementation(projects.feature.account.setup)
|
||||
}
|
||||
|
|
|
@ -4,8 +4,10 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import net.thunderbird.feature.onboarding.navigation.NAVIGATION_ROUTE_ONBOARDING
|
||||
import net.thunderbird.feature.onboarding.navigation.onboardingScreen
|
||||
import app.k9mail.feature.account.setup.navigation.accountSetupScreen
|
||||
import app.k9mail.feature.account.setup.navigation.navigateToAccountSetup
|
||||
import app.k9mail.feature.onboarding.navigation.NAVIGATION_ROUTE_ONBOARDING
|
||||
import app.k9mail.feature.onboarding.navigation.onboardingScreen
|
||||
|
||||
@Composable
|
||||
fun FeatureNavHost(
|
||||
|
@ -19,8 +21,12 @@ fun FeatureNavHost(
|
|||
modifier = modifier,
|
||||
) {
|
||||
onboardingScreen(
|
||||
onStartClick = { /* TODO */ },
|
||||
onStartClick = { navController.navigateToAccountSetup() },
|
||||
onImportClick = { /* TODO */ },
|
||||
)
|
||||
accountSetupScreen(
|
||||
onBackClick = navController::popBackStack,
|
||||
onFinishClick = { /* TODO */ },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package app.k9mail.core.ui.compose.designsystem.atom
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
|
||||
import androidx.compose.material.CircularProgressIndicator as MaterialCircularProgressIndicator
|
||||
|
||||
@Composable
|
||||
fun CircularProgressIndicator(
|
||||
progress: Float,
|
||||
modifier: Modifier = Modifier,
|
||||
color: Color = MainTheme.colors.secondary,
|
||||
) {
|
||||
MaterialCircularProgressIndicator(
|
||||
progress = progress,
|
||||
modifier = modifier,
|
||||
color = color,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CircularProgressIndicator(
|
||||
modifier: Modifier = Modifier,
|
||||
color: Color = MainTheme.colors.secondary,
|
||||
) {
|
||||
MaterialCircularProgressIndicator(
|
||||
modifier = modifier,
|
||||
color = color,
|
||||
)
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
internal fun CircularProgressIndicatorPreview() {
|
||||
PreviewWithThemes {
|
||||
CircularProgressIndicator(progress = 0.75f)
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.PaddingValues
|
|||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextButton
|
||||
|
@ -24,7 +25,9 @@ fun ButtonOutlined(
|
|||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
colors = ButtonDefaults.outlinedButtonColors(),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
backgroundColor = Color.Transparent,
|
||||
),
|
||||
border = BorderStroke(
|
||||
width = 1.dp,
|
||||
color = if (enabled) {
|
||||
|
|
|
@ -11,57 +11,64 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.Surface
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
|
||||
/**
|
||||
* The [LazyColumnWithFooter] composable creates a [LazyColumn] with a footer.
|
||||
* The [LazyColumnWithHeaderFooter] composable creates a [LazyColumn] with header and footer items.
|
||||
*
|
||||
* @param modifier The modifier to be applied to the layout.
|
||||
* @param verticalArrangement The vertical arrangement of the children.
|
||||
* @param horizontalAlignment The horizontal alignment of the children.
|
||||
* @param header The header to be displayed at the top of the [LazyColumn].
|
||||
* @param footer The footer to be displayed at the bottom of the [LazyColumn].
|
||||
* @param content The content of the [LazyColumn].
|
||||
*/
|
||||
@Composable
|
||||
fun LazyColumnWithFooter(
|
||||
fun LazyColumnWithHeaderFooter(
|
||||
modifier: Modifier = Modifier,
|
||||
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
|
||||
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
|
||||
header: @Composable () -> Unit = {},
|
||||
footer: @Composable () -> Unit = {},
|
||||
content: LazyListScope.() -> Unit,
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = modifier,
|
||||
verticalArrangement = verticalArrangementWithFooter(verticalArrangement),
|
||||
verticalArrangement = verticalArrangementWithHeaderFooter(verticalArrangement),
|
||||
horizontalAlignment = horizontalAlignment,
|
||||
) {
|
||||
item { header() }
|
||||
content()
|
||||
item { footer() }
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun verticalArrangementWithFooter(verticalArrangement: Arrangement.Vertical) = remember {
|
||||
private fun verticalArrangementWithHeaderFooter(verticalArrangement: Arrangement.Vertical) = remember {
|
||||
object : Arrangement.Vertical {
|
||||
override fun Density.arrange(
|
||||
totalSize: Int,
|
||||
sizes: IntArray,
|
||||
outPositions: IntArray,
|
||||
) {
|
||||
val innerSizes = sizes.dropLast(1).toIntArray()
|
||||
val headerSize = sizes.first()
|
||||
val footerSize = sizes.last()
|
||||
val innerTotalSize = totalSize - footerSize
|
||||
val innerTotalSize = totalSize - (headerSize + footerSize)
|
||||
val innerSizes = sizes.copyOfRange(1, sizes.lastIndex)
|
||||
val innerOutPositions = outPositions.copyOfRange(1, outPositions.lastIndex)
|
||||
|
||||
with(verticalArrangement) {
|
||||
arrange(
|
||||
totalSize = innerTotalSize,
|
||||
sizes = innerSizes,
|
||||
outPositions = outPositions,
|
||||
outPositions = innerOutPositions,
|
||||
)
|
||||
}
|
||||
|
||||
innerOutPositions.forEachIndexed { index, position -> outPositions[index + 1] = position + headerSize }
|
||||
outPositions[0] = 0
|
||||
outPositions[outPositions.lastIndex] = totalSize - footerSize
|
||||
}
|
||||
}
|
||||
|
@ -69,12 +76,13 @@ private fun verticalArrangementWithFooter(verticalArrangement: Arrangement.Verti
|
|||
|
||||
@Composable
|
||||
@Preview
|
||||
internal fun LazyColumnWithFooterPreview() {
|
||||
internal fun LazyColumnWithHeaderFooterPreview() {
|
||||
K9Theme {
|
||||
Surface {
|
||||
LazyColumnWithFooter(
|
||||
LazyColumnWithHeaderFooter(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(32.dp, Alignment.CenterVertically),
|
||||
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double, Alignment.CenterVertically),
|
||||
header = { Text(text = "Header") },
|
||||
footer = { Text(text = "Footer") },
|
||||
) {
|
||||
items(10) {
|
|
@ -0,0 +1,47 @@
|
|||
package app.k9mail.core.ui.compose.designsystem.template
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import app.k9mail.core.ui.compose.common.DevicePreviews
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.Background
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.Surface
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
|
||||
/**
|
||||
* The [ResponsiveContentWithBackground] composable embeds its content in [ResponsiveContent] with [Background].
|
||||
*
|
||||
* @param modifier The modifier to be applied to the layout.
|
||||
* @param content The content to be displayed.
|
||||
*/
|
||||
@Composable
|
||||
fun ResponsiveContentWithBackground(
|
||||
modifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
ResponsiveContent {
|
||||
Background(
|
||||
modifier = modifier,
|
||||
) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun ResponsiveContentWithBackgroundPreview() {
|
||||
K9Theme {
|
||||
ResponsiveContentWithBackground {
|
||||
Surface(
|
||||
color = MainTheme.colors.info,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(MainTheme.spacings.double),
|
||||
content = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
12
feature/account/setup/build.gradle.kts
Normal file
12
feature/account/setup/build.gradle.kts
Normal file
|
@ -0,0 +1,12 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.androidCompose)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.k9mail.feature.account.setup"
|
||||
resourcePrefix = "account_setup_"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.ui.compose.designsystem)
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package app.k9mail.feature.account.setup.navigation
|
||||
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.compose.composable
|
||||
import app.k9mail.feature.account.setup.ui.AccountSetupScreen
|
||||
|
||||
const val NAVIGATION_ROUTE_ACCOUNT_SETUP = "/account/setup"
|
||||
|
||||
fun NavController.navigateToAccountSetup(navOptions: NavOptions? = null) {
|
||||
navigate(NAVIGATION_ROUTE_ACCOUNT_SETUP, navOptions)
|
||||
}
|
||||
|
||||
fun NavGraphBuilder.accountSetupScreen(
|
||||
onBackClick: () -> Unit,
|
||||
onFinishClick: () -> Unit,
|
||||
) {
|
||||
composable(route = NAVIGATION_ROUTE_ACCOUNT_SETUP) {
|
||||
AccountSetupScreen(
|
||||
onBackClick = onBackClick,
|
||||
onFinishClick = onFinishClick,
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package app.k9mail.feature.account.setup.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import app.k9mail.feature.account.setup.ui.autoconfig.AccountAutoConfigScreen
|
||||
import app.k9mail.feature.account.setup.ui.manualconfig.AccountManualConfigScreen
|
||||
import app.k9mail.feature.account.setup.ui.options.AccountOptionsScreen
|
||||
|
||||
@Composable
|
||||
fun AccountSetupScreen(
|
||||
onFinishClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
val accountSetupSteps = remember { mutableStateOf(AccountSetupSteps.AUTO_CONFIG) }
|
||||
|
||||
when (accountSetupSteps.value) {
|
||||
AccountSetupSteps.AUTO_CONFIG -> {
|
||||
AccountAutoConfigScreen(
|
||||
onNextClick = {
|
||||
// TODO validate config
|
||||
accountSetupSteps.value = AccountSetupSteps.MANUAL_CONFIG
|
||||
},
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
}
|
||||
|
||||
AccountSetupSteps.MANUAL_CONFIG -> {
|
||||
AccountManualConfigScreen(
|
||||
onNextClick = {
|
||||
accountSetupSteps.value = AccountSetupSteps.OPTIONS
|
||||
},
|
||||
onBackClick = {
|
||||
accountSetupSteps.value = AccountSetupSteps.AUTO_CONFIG
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
AccountSetupSteps.OPTIONS -> {
|
||||
AccountOptionsScreen(
|
||||
// validate account
|
||||
onFinishClick = onFinishClick,
|
||||
onBackClick = {
|
||||
accountSetupSteps.value = AccountSetupSteps.MANUAL_CONFIG
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class AccountSetupSteps {
|
||||
AUTO_CONFIG,
|
||||
MANUAL_CONFIG,
|
||||
OPTIONS,
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
internal fun AccountSetupScreenPreview() {
|
||||
AccountSetupScreen(
|
||||
onFinishClick = {},
|
||||
onBackClick = {},
|
||||
)
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package app.k9mail.feature.account.setup.ui
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class AccountSetupViewModel : ViewModel()
|
|
@ -0,0 +1,141 @@
|
|||
package app.k9mail.feature.account.setup.ui.autoconfig
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
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.requiredHeight
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import app.k9mail.core.ui.compose.common.DevicePreviews
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.Button
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline2
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.textfield.TextFieldOutlined
|
||||
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter
|
||||
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContentWithBackground
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
|
||||
import app.k9mail.feature.account.setup.R
|
||||
|
||||
@Composable
|
||||
internal fun AccountAutoConfigContent(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
ResponsiveContentWithBackground(
|
||||
modifier = modifier,
|
||||
) {
|
||||
LazyColumnWithHeaderFooter(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
header = {
|
||||
AccountSetupHeader()
|
||||
},
|
||||
footer = {
|
||||
AccountSetupFooter(
|
||||
onNextClick = onNextClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
},
|
||||
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double, Alignment.CenterVertically),
|
||||
) {
|
||||
item { Spacer(modifier = Modifier.height(MainTheme.sizes.larger)) }
|
||||
item {
|
||||
AccountSetupEmailForm(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
item { Spacer(modifier = Modifier.height(MainTheme.sizes.larger)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountSetupHeader(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = MainTheme.spacings.double,
|
||||
end = MainTheme.spacings.double,
|
||||
bottom = MainTheme.spacings.triple,
|
||||
)
|
||||
.requiredHeight(MainTheme.sizes.larger)
|
||||
.then(modifier),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Bottom,
|
||||
) {
|
||||
TextHeadline2(text = stringResource(id = R.string.account_setup_title))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountSetupEmailForm(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
TextFieldOutlined(
|
||||
value = "",
|
||||
onValueChange = { /*TODO*/ },
|
||||
label = "Email address",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountSetupFooter(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = MainTheme.spacings.quadruple,
|
||||
top = MainTheme.spacings.triple,
|
||||
end = MainTheme.spacings.quadruple,
|
||||
bottom = MainTheme.spacings.double,
|
||||
)
|
||||
.then(modifier),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
ButtonOutlined(
|
||||
text = stringResource(id = R.string.account_setup_button_back),
|
||||
onClick = onBackClick,
|
||||
)
|
||||
Button(
|
||||
text = stringResource(id = R.string.account_setup_button_next),
|
||||
onClick = onNextClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountAutoConfigContentK9Preview() {
|
||||
K9Theme {
|
||||
AccountAutoConfigContent({}, {})
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountAutoConfigContentThunderbirdPreview() {
|
||||
ThunderbirdTheme {
|
||||
AccountAutoConfigContent({}, {})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package app.k9mail.feature.account.setup.ui.autoconfig
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun AccountAutoConfigScreen(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
AccountAutoConfigContent(
|
||||
onNextClick = onNextClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package app.k9mail.feature.account.setup.ui.manualconfig
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
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.res.stringResource
|
||||
import app.k9mail.core.ui.compose.common.DevicePreviews
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.Button
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline5
|
||||
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter
|
||||
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContentWithBackground
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
|
||||
import app.k9mail.feature.account.setup.R
|
||||
|
||||
@Composable
|
||||
internal fun AccountManualConfigContent(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
ResponsiveContentWithBackground(
|
||||
modifier = modifier,
|
||||
) {
|
||||
LazyColumnWithHeaderFooter(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.SpaceEvenly,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
footer = {
|
||||
AccountManualConfigFooter(
|
||||
onNextClick = onNextClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
},
|
||||
) {
|
||||
item {
|
||||
TextHeadline5(text = "Manual Config")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountManualConfigFooter(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = MainTheme.spacings.quadruple,
|
||||
top = MainTheme.spacings.triple,
|
||||
end = MainTheme.spacings.quadruple,
|
||||
bottom = MainTheme.spacings.double,
|
||||
)
|
||||
.then(modifier),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
ButtonOutlined(
|
||||
text = stringResource(id = R.string.account_setup_button_back),
|
||||
onClick = onBackClick,
|
||||
)
|
||||
Button(
|
||||
text = stringResource(id = R.string.account_setup_button_next),
|
||||
onClick = onNextClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountManualConfigContentK9Preview() {
|
||||
K9Theme {
|
||||
AccountManualConfigContent(
|
||||
onNextClick = { },
|
||||
onBackClick = { },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountManualConfigContentThunderbirdPreview() {
|
||||
ThunderbirdTheme {
|
||||
AccountManualConfigContent(
|
||||
onNextClick = { },
|
||||
onBackClick = { },
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package app.k9mail.feature.account.setup.ui.manualconfig
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun AccountManualConfigScreen(
|
||||
onNextClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
AccountManualConfigContent(
|
||||
onNextClick = onNextClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package app.k9mail.feature.account.setup.ui.options
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
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.res.stringResource
|
||||
import app.k9mail.core.ui.compose.common.DevicePreviews
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.Button
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline5
|
||||
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter
|
||||
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContentWithBackground
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
|
||||
import app.k9mail.feature.account.setup.R
|
||||
|
||||
@Composable
|
||||
internal fun AccountOptionsContent(
|
||||
onFinishClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
ResponsiveContentWithBackground(
|
||||
modifier = modifier,
|
||||
) {
|
||||
LazyColumnWithHeaderFooter(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.SpaceEvenly,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
footer = {
|
||||
AccountOptionsFooter(
|
||||
onFinishClick = onFinishClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
},
|
||||
) {
|
||||
item {
|
||||
TextHeadline5(text = "Options")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountOptionsFooter(
|
||||
onFinishClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = MainTheme.spacings.quadruple,
|
||||
top = MainTheme.spacings.triple,
|
||||
end = MainTheme.spacings.quadruple,
|
||||
bottom = MainTheme.spacings.double,
|
||||
)
|
||||
.then(modifier),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
ButtonOutlined(
|
||||
text = stringResource(id = R.string.account_setup_button_back),
|
||||
onClick = onBackClick,
|
||||
)
|
||||
Button(
|
||||
text = stringResource(id = R.string.account_setup_button_finish),
|
||||
onClick = onFinishClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountOptionsContentK9Preview() {
|
||||
K9Theme {
|
||||
AccountOptionsContent(
|
||||
onFinishClick = { },
|
||||
onBackClick = { },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@DevicePreviews
|
||||
internal fun AccountOptionsContentThunderbirdPreview() {
|
||||
ThunderbirdTheme {
|
||||
AccountOptionsContent(
|
||||
onFinishClick = { },
|
||||
onBackClick = { },
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package app.k9mail.feature.account.setup.ui.options
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun AccountOptionsScreen(
|
||||
onFinishClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
AccountOptionsContent(
|
||||
onFinishClick = onFinishClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
}
|
7
feature/account/setup/src/main/res/values/strings.xml
Normal file
7
feature/account/setup/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="account_setup_title">K-9 Mail</string>
|
||||
<string name="account_setup_button_next">Next</string>
|
||||
<string name="account_setup_button_back">Back</string>
|
||||
<string name="account_setup_button_finish">Finish</string>
|
||||
</resources>
|
|
@ -3,7 +3,7 @@ plugins {
|
|||
}
|
||||
|
||||
android {
|
||||
namespace = "net.thunderbird.feature.onboarding"
|
||||
namespace = "app.k9mail.feature.onboarding"
|
||||
resourcePrefix = "onboarding_"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package net.thunderbird.feature.onboarding.navigation
|
||||
package app.k9mail.feature.onboarding.navigation
|
||||
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.compose.composable
|
||||
import net.thunderbird.feature.onboarding.OnboardingScreen
|
||||
import app.k9mail.feature.onboarding.ui.OnboardingScreen
|
||||
|
||||
const val NAVIGATION_ROUTE_ONBOARDING = "onboarding"
|
||||
const val NAVIGATION_ROUTE_ONBOARDING = "/onboarding"
|
||||
|
||||
fun NavController.navigateToOnboarding(
|
||||
navOptions: NavOptions? = null,
|
|
@ -1,4 +1,4 @@
|
|||
package net.thunderbird.feature.onboarding
|
||||
package app.k9mail.feature.onboarding.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
|
@ -18,11 +18,12 @@ import app.k9mail.core.ui.compose.designsystem.atom.button.Button
|
|||
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody1
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline2
|
||||
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithFooter
|
||||
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter
|
||||
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContent
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
|
||||
import app.k9mail.feature.onboarding.R
|
||||
|
||||
@Composable
|
||||
internal fun OnboardingContent(
|
||||
|
@ -34,7 +35,7 @@ internal fun OnboardingContent(
|
|||
modifier = modifier,
|
||||
) {
|
||||
ResponsiveContent {
|
||||
LazyColumnWithFooter(
|
||||
LazyColumnWithHeaderFooter(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
footer = {
|
||||
WelcomeFooter(
|
||||
|
@ -45,13 +46,13 @@ internal fun OnboardingContent(
|
|||
onImportClick = onImportClick,
|
||||
)
|
||||
},
|
||||
verticalArrangement = Arrangement.spacedBy(MainTheme.sizes.medium, Alignment.CenterVertically),
|
||||
verticalArrangement = Arrangement.SpaceEvenly,
|
||||
) {
|
||||
item {
|
||||
WelcomeLogo(
|
||||
modifier = Modifier
|
||||
.defaultItemModifier()
|
||||
.padding(top = MainTheme.spacings.quadruple),
|
||||
.padding(top = MainTheme.spacings.double),
|
||||
)
|
||||
}
|
||||
item {
|
||||
|
@ -121,8 +122,8 @@ private fun WelcomeFooter(
|
|||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
|
||||
modifier = modifier.padding(bottom = MainTheme.spacings.double),
|
||||
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.quarter),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Button(
|
||||
|
@ -138,7 +139,7 @@ private fun WelcomeFooter(
|
|||
|
||||
private fun Modifier.defaultItemModifier() = composed {
|
||||
fillMaxWidth()
|
||||
.padding(MainTheme.spacings.double)
|
||||
.padding(MainTheme.spacings.default)
|
||||
}
|
||||
|
||||
@Composable
|
|
@ -1,4 +1,4 @@
|
|||
package net.thunderbird.feature.onboarding
|
||||
package app.k9mail.feature.onboarding.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
|
@ -2,8 +2,8 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:width="330dp"
|
||||
android:height="330dp"
|
||||
android:width="300dp"
|
||||
android:height="300dp"
|
||||
android:viewportWidth="330"
|
||||
android:viewportHeight="330"
|
||||
tools:ignore="VectorRaster">
|
||||
|
|
|
@ -39,6 +39,7 @@ include(
|
|||
)
|
||||
|
||||
include(
|
||||
":feature:account:setup",
|
||||
":feature:onboarding",
|
||||
":feature:autodiscovery:api",
|
||||
":feature:autodiscovery:providersxml",
|
||||
|
|
Loading…
Reference in a new issue