From 0e6f5f741401e4449b352ec5f8bb494d03c9422f Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Tue, 18 Jun 2024 11:00:14 +0200 Subject: [PATCH] Add auto-capitalization to custom list name input --- .../mullvadvpn/compose/component/CustomListNameTextField.kt | 2 ++ .../mullvad/mullvadvpn/compose/textfield/CustomTextField.kt | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CustomListNameTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CustomListNameTextField.kt index bb4339a1f799..f0cb0e820964 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CustomListNameTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CustomListNameTextField.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType import net.mullvad.mullvadvpn.compose.textfield.CustomTextField import net.mullvad.mullvadvpn.lib.model.CustomListName @@ -50,6 +51,7 @@ fun CustomListNameTextField( ) } }, + capitalization = KeyboardCapitalization.Words, modifier = modifier.focusRequester(focusRequester).onFocusChanged { focusState -> if (focusState.hasFocus) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt index ac73e9fa34e3..fb325ffb46b0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.VisualTransformation @@ -43,12 +44,14 @@ fun CustomTextField( visualTransformation: VisualTransformation = VisualTransformation.None, supportingText: @Composable (() -> Unit)? = null, colors: TextFieldColors = mullvadDarkTextFieldColors(), + capitalization: KeyboardCapitalization = KeyboardCapitalization.None, keyboardOptions: KeyboardOptions = KeyboardOptions( keyboardType = keyboardType, imeAction = ImeAction.Done, autoCorrect = false, - ) + capitalization = capitalization + ), ) { val scope = rememberCoroutineScope()