Extracted KeyboardOptions.ImeNext and KeyboardOptions.ImeDone

This commit is contained in:
dankito 2024-09-26 05:15:38 +02:00
parent 0aa25e0c59
commit ba8b475eaf
5 changed files with 19 additions and 5 deletions

View File

@ -20,6 +20,7 @@ import net.codinux.banking.ui.IOorDefault
import net.codinux.banking.ui.composables.BankIcon
import net.codinux.banking.ui.config.Colors
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.extensions.ImeNext
import net.codinux.banking.ui.forms.*
import net.codinux.banking.ui.forms.OutlinedTextField
import net.codinux.banking.ui.model.BankInfo
@ -161,7 +162,7 @@ fun AddAccountDialog(
onValueChange = { loginName = it },
label = { Text("Login Name") },
modifier = Modifier.fillMaxWidth().focusRequester(loginNameFocus),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)
keyboardOptions = KeyboardOptions.ImeNext
)
Spacer(modifier = Modifier.height(12.dp))

View File

@ -20,6 +20,7 @@ import net.codinux.banking.ui.IOorDefault
import net.codinux.banking.ui.composables.BankIcon
import net.codinux.banking.ui.config.Colors
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.extensions.ImeNext
import net.codinux.banking.ui.forms.AutocompleteTextField
import net.codinux.banking.ui.forms.CaptionText
import net.codinux.banking.ui.forms.OutlinedTextField
@ -191,7 +192,7 @@ fun TransferMoneyDialog(
onValueChange = { recipientAccountIdentifier = it },
label = { Text("IBAN") },
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)
keyboardOptions = KeyboardOptions.ImeNext
)
Row(Modifier.padding(vertical = verticalSpace).fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {

View File

@ -0,0 +1,11 @@
package net.codinux.banking.ui.extensions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.ui.text.input.ImeAction
val KeyboardOptions.Companion.ImeNext: KeyboardOptions
get() = KeyboardOptions(imeAction = ImeAction.Next)
val KeyboardOptions.Companion.ImeDone: KeyboardOptions
get() = KeyboardOptions(imeAction = ImeAction.Done)

View File

@ -72,7 +72,6 @@ fun LoginScreen(appSettings: AppSettings, onLoginSuccess: () -> Unit) {
PasswordTextField(
password = password,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
onEnterPressed = { checkPassword() },
isError = showError
) {

View File

@ -15,6 +15,8 @@ import net.codinux.banking.ui.composables.authentification.BiometricAuthenticati
import net.codinux.banking.ui.config.Colors
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.config.Internationalization
import net.codinux.banking.ui.extensions.ImeDone
import net.codinux.banking.ui.extensions.ImeNext
import net.codinux.banking.ui.extensions.verticalScroll
import net.codinux.banking.ui.forms.PasswordTextField
import net.codinux.banking.ui.forms.SegmentedControl
@ -92,9 +94,9 @@ fun ProtectAppSettingsDialog(appSettings: AppSettings, onClosed: () -> Unit) {
}
if (selectedAuthenticationMethod == AppAuthenticationMethod.Password) {
PasswordTextField(newPassword, "Neues Password", keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)) { newPassword = it }
PasswordTextField(newPassword, "Neues Password", keyboardOptions = KeyboardOptions.ImeNext) { newPassword = it }
PasswordTextField(confirmedNewPassword, "Password bestätigen", Modifier.padding(top = 16.dp), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done)) { confirmedNewPassword = it }
PasswordTextField(confirmedNewPassword, "Password bestätigen", Modifier.padding(top = 16.dp), keyboardOptions = KeyboardOptions.ImeDone) { confirmedNewPassword = it }
}
if (selectedAuthenticationMethod == AppAuthenticationMethod.Biometric) {