From 1990dfbabfd372f8a139461d6c36c18719028623 Mon Sep 17 00:00:00 2001 From: andrekir Date: Mon, 26 Feb 2024 19:22:12 -0300 Subject: [PATCH] fix: clear focus before deleting `ignore_incoming` closes #872 --- .../com/geeksville/mesh/ui/components/EditListPreference.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt b/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt index 3a85c1c0..5f7e08e0 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/EditListPreference.kt @@ -20,6 +20,7 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -41,6 +42,7 @@ inline fun EditListPreference( crossinline onValuesChanged: (List) -> Unit, modifier: Modifier = Modifier, ) { + val focusManager = LocalFocusManager.current val listState = remember(list) { mutableStateListOf().apply { addAll(list) } } Column(modifier = modifier) { @@ -65,6 +67,7 @@ inline fun EditListPreference( trailingIcon = { IconButton( onClick = { + focusManager.clearFocus() listState.removeAt(index) onValuesChanged(listState) } @@ -109,6 +112,7 @@ inline fun EditListPreference( trailingIcon = { IconButton( onClick = { + focusManager.clearFocus() listState.removeAt(index) onValuesChanged(listState) }