diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTextField.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTextField.kt index de1a27322..610c314d0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTextField.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTextField.kt @@ -20,6 +20,7 @@ package com.infomaniak.swisstransfer.ui.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.* import androidx.compose.runtime.Composable @@ -30,6 +31,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation @@ -57,6 +59,8 @@ fun SwissTransferTextField( maxLineNumber: Int = if (minLineNumber > 1) Int.MAX_VALUE else 1, isPassword: Boolean = false, keyboardType: KeyboardType = KeyboardType.Text, + imeAction: ImeAction = ImeAction.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, errorMessage: @Composable () -> String? = { null }, supportingText: String? = null, onValueChange: ((String) -> Unit)? = null, @@ -101,7 +105,9 @@ fun SwissTransferTextField( keyboardOptions = KeyboardOptions( keyboardType = if (isPassword) KeyboardType.Password else keyboardType, autoCorrectEnabled = true, + imeAction = imeAction, ), + keyboardActions = keyboardActions, isError = errorMessage() != null && text.isNotEmpty(), supportingText = getSupportingText(), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt index 52d029831..942038d2e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt @@ -30,6 +30,7 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.tooling.preview.Preview import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.SwissTransferAlertDialog @@ -109,6 +110,7 @@ private fun ColumnScope.AnimatedPasswordInput( label = stringResource(R.string.settingsOptionPassword), isPassword = true, initialValue = password.get(), + imeAction = ImeAction.Done, errorMessage = { if (isPasswordValid()) null else stringResource(R.string.errorTransferPasswordLength) }, onValueChange = { password.set(it) }, )