From 3f5fc036ff8e8d644b4ad36f83b2bcd80a29538e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kalle=20Lindstr=C3=B6m?= Date: Fri, 4 Oct 2024 13:33:44 +0200 Subject: [PATCH] Fix non-English IME input in custom list input --- .../mullvadvpn/compose/dialog/CreateCustomListDialog.kt | 7 +++---- .../compose/textfield/CustomListNameTextField.kt | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt index a7656573b149..fc9109cf4d10 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt @@ -2,10 +2,9 @@ package net.mullvad.mullvadvpn.compose.dialog import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource @@ -97,8 +96,8 @@ fun CreateCustomListDialog( onInputChanged: () -> Unit = {}, onDismiss: () -> Unit = {}, ) { - val name = remember { mutableStateOf("") } - val isValidName by remember { derivedStateOf { name.value.isNotBlank() } } + val name = rememberSaveable { mutableStateOf("") } + val isValidName = name.value.isNotBlank() InputDialog( title = stringResource(id = R.string.create_new_list), diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt index d8439a5c0dcc..ddbd1fd8d033 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt @@ -33,9 +33,7 @@ fun CustomListNameTextField( onSubmit(it) } }, - // This can not be set to KeyboardType.Text because it will show the - // suggestions, this will cause an infinite loop on Android TV with Gboard - keyboardType = KeyboardType.Password, + keyboardType = KeyboardType.Text, placeholderText = null, isValidValue = error == null, isDigitsOnlyAllowed = false,