Disable "IMAP path prefix" input when auto-detecting IMAP namespace

This commit is contained in:
cketti 2023-07-17 11:53:21 +02:00
parent 23add3be6f
commit d8489c1cf1
2 changed files with 18 additions and 7 deletions

View file

@ -19,6 +19,7 @@ fun TextInput(
errorMessage: String? = null,
contentPadding: PaddingValues = inputContentPadding(),
isSingleLine: Boolean = true,
isEnabled: Boolean = true,
) {
InputLayout(
modifier = modifier,
@ -29,6 +30,7 @@ fun TextInput(
value = text,
onValueChange = onTextChange,
label = label,
isEnabled = isEnabled,
isRequired = isRequired,
hasError = errorMessage != null,
isSingleLine = isSingleLine,

View file

@ -194,13 +194,22 @@ internal fun AccountIncomingConfigContent(
}
item {
TextInput(
text = state.imapPrefix.value,
errorMessage = state.imapPrefix.error?.toResourceString(resources),
onTextChange = { onEvent(Event.ImapPrefixChanged(it)) },
label = stringResource(id = R.string.account_setup_incoming_config_imap_prefix_label),
contentPadding = defaultItemPadding(),
)
if (state.imapAutodetectNamespaceEnabled) {
TextInput(
onTextChange = {},
label = stringResource(id = R.string.account_setup_incoming_config_imap_prefix_label),
contentPadding = defaultItemPadding(),
isEnabled = false,
)
} else {
TextInput(
text = state.imapPrefix.value,
errorMessage = state.imapPrefix.error?.toResourceString(resources),
onTextChange = { onEvent(Event.ImapPrefixChanged(it)) },
label = stringResource(id = R.string.account_setup_incoming_config_imap_prefix_label),
contentPadding = defaultItemPadding(),
)
}
}
item {