From b9b0e6329ab9e8e3df7c5b5c79735927fd0909c6 Mon Sep 17 00:00:00 2001 From: MaryamShaghaghi <122574719+MaryamShaghaghi@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:07:20 +0100 Subject: [PATCH 1/2] Show the selected location while typing in the search text field --- .../net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt index b9390cd4efef..9a9705b71575 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt @@ -163,7 +163,7 @@ fun RelayLocationCell( RelayItemType.City -> Dimens.cityRowPadding RelayItemType.Relay -> Dimens.relayRowPadding } - val selected = selectedItem == relay + val selected = selectedItem?.code == relay.code val expanded = remember(key1 = relay.expanded.toString()) { mutableStateOf(relay.expanded) } val backgroundColor = when { From 946f749fbcc9aa6ae986449f133456bcbf7b9d45 Mon Sep 17 00:00:00 2001 From: MaryamShaghaghi <122574719+MaryamShaghaghi@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:10:44 +0100 Subject: [PATCH 2/2] Fix bug to remember expanded relay cell --- .../net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt index 9a9705b71575..acd963fa61b8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt @@ -19,7 +19,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha @@ -164,7 +164,8 @@ fun RelayLocationCell( RelayItemType.Relay -> Dimens.relayRowPadding } val selected = selectedItem?.code == relay.code - val expanded = remember(key1 = relay.expanded.toString()) { mutableStateOf(relay.expanded) } + val expanded = + rememberSaveable(key = relay.expanded.toString()) { mutableStateOf(relay.expanded) } val backgroundColor = when { selected -> MaterialTheme.colorScheme.inversePrimary