Skip to content

Commit

Permalink
feat(TransferPasswordAlertDialog): Add ImeAction configuration in Tex…
Browse files Browse the repository at this point in the history
…tField
  • Loading branch information
FabianDevel committed Nov 7, 2024
1 parent 759839a commit 37ca98e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,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.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.input.*
import androidx.compose.ui.tooling.preview.Preview
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
Expand All @@ -57,6 +55,7 @@ fun SwissTransferTextField(
maxLineNumber: Int = if (minLineNumber > 1) Int.MAX_VALUE else 1,
isPassword: Boolean = false,
keyboardType: KeyboardType = KeyboardType.Text,
imeAction: ImeAction = ImeAction.Default,
errorMessage: @Composable () -> String? = { null },
supportingText: String? = null,
onValueChange: ((String) -> Unit)? = null,
Expand Down Expand Up @@ -101,6 +100,7 @@ fun SwissTransferTextField(
keyboardOptions = KeyboardOptions(
keyboardType = if (isPassword) KeyboardType.Password else keyboardType,
autoCorrectEnabled = true,
imeAction = imeAction,
),
isError = errorMessage() != null && text.isNotEmpty(),
supportingText = getSupportingText(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) },
)
Expand Down

0 comments on commit 37ca98e

Please sign in to comment.