@@ -563,22 +563,27 @@ private fun BottomSheets(
563
563
}
564
564
565
565
private fun SelectLocationUiState.Content.indexOfSelectedRelayItem (): Int {
566
- val rawIndex =
567
- countries.indexOfFirst { relayCountry ->
568
- relayCountry.location.location.country ==
569
- when (selectedItem) {
570
- is RelayItem .Country -> selectedItem.code
571
- is RelayItem .City -> selectedItem.location.countryCode
572
- is RelayItem .Relay -> selectedItem.location.countryCode
573
- is RelayItem .CustomList ,
574
- null -> null
575
- }
576
- }
577
- return if (rawIndex >= 0 ) {
578
- // Extra items are: Custom list header, custom list description and locations header
579
- return rawIndex + customLists.size + EXTRA_ITEMS
566
+ if (selectedItem is RelayItem .CustomList ) {
567
+ // Add the header for custom list
568
+ return filteredCustomLists.indexOfFirst { it.id == selectedItem.id } +
569
+ EXTRA_ITEM_CUSTOM_LIST
580
570
} else {
581
- rawIndex
571
+ val rawIndex =
572
+ countries.indexOfFirst { relayCountry ->
573
+ relayCountry.location.location.country ==
574
+ when (selectedItem) {
575
+ is RelayItem .Country -> selectedItem.code
576
+ is RelayItem .City -> selectedItem.location.countryCode
577
+ is RelayItem .Relay -> selectedItem.location.countryCode
578
+ else -> null
579
+ }
580
+ }
581
+ return if (rawIndex >= 0 ) {
582
+ // Extra items are: Custom list header, custom list description and locations header
583
+ return rawIndex + customLists.size + EXTRA_ITEMS_LOCATION
584
+ } else {
585
+ rawIndex
586
+ }
582
587
}
583
588
}
584
589
@@ -687,10 +692,7 @@ private fun EditCustomListBottomSheet(
687
692
closeBottomSheet : () -> Unit
688
693
) {
689
694
MullvadModalBottomSheet (closeBottomSheet = closeBottomSheet) { onBackgroundColor, onClose ->
690
- HeaderCell (
691
- text = stringResource(id = R .string.edit_custom_lists),
692
- background = Color .Unspecified
693
- )
695
+ HeaderCell (text = customList.name, background = Color .Unspecified )
694
696
IconCell (
695
697
iconId = R .drawable.icon_edit,
696
698
title = stringResource(id = R .string.edit_name),
@@ -761,7 +763,8 @@ private fun CustomListResult.message(context: Context): String =
761
763
context.getString(R .string.locations_were_changed_for, name)
762
764
}
763
765
764
- private const val EXTRA_ITEMS = 3
766
+ private const val EXTRA_ITEMS_LOCATION = 3
767
+ private const val EXTRA_ITEM_CUSTOM_LIST = 1
765
768
766
769
sealed interface BottomSheetState {
767
770
data object Hidden : BottomSheetState
0 commit comments