diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt
index 347de1654edb..579be88bb646 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt
@@ -1,51 +1,29 @@
package net.mullvad.mullvadvpn.compose.component
-import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
-import androidx.core.text.HtmlCompat
import net.mullvad.mullvadvpn.R
-import net.mullvad.mullvadvpn.compose.extensions.toAnnotatedString
import net.mullvad.mullvadvpn.lib.theme.Dimens
import net.mullvad.mullvadvpn.relaylist.MIN_SEARCH_LENGTH
@Composable
fun LocationsEmptyText(searchTerm: String) {
if (searchTerm.length >= MIN_SEARCH_LENGTH) {
- val firstRow =
- HtmlCompat.fromHtml(
- textResource(id = R.string.select_location_empty_text_first_row, searchTerm),
- HtmlCompat.FROM_HTML_MODE_COMPACT,
- )
- .toAnnotatedString(boldFontWeight = FontWeight.ExtraBold)
- val secondRow = textResource(id = R.string.select_location_empty_text_second_row)
- Column(
- modifier = Modifier.padding(horizontal = Dimens.selectLocationTitlePadding),
- horizontalAlignment = Alignment.CenterHorizontally,
- ) {
- Text(
- text = firstRow,
- style = MaterialTheme.typography.labelMedium,
- textAlign = TextAlign.Center,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- )
- Text(
- text = secondRow,
- style = MaterialTheme.typography.labelMedium,
- textAlign = TextAlign.Center,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
- }
+ Text(
+ text = textResource(R.string.search_location_empty_text, searchTerm),
+ style = MaterialTheme.typography.labelMedium,
+ textAlign = TextAlign.Center,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(Dimens.screenVerticalMargin),
+ )
} else {
Text(
text = stringResource(R.string.no_locations_found),
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/RelayListContent.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/RelayListContent.kt
index 1fad1dc173be..01c06273c2dc 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/RelayListContent.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/RelayListContent.kt
@@ -47,9 +47,7 @@ fun LazyListScope.relayListContent(
}
)
},
- locationHeader: @Composable LazyItemScope.() -> Unit = {
- RelayLocationHeader()
- }
+ locationHeader: @Composable LazyItemScope.() -> Unit = { RelayLocationHeader() },
) {
itemsIndexed(
items = relayListItems,
@@ -61,17 +59,7 @@ fun LazyListScope.relayListContent(
HorizontalDivider(color = backgroundColor)
}
when (listItem) {
- RelayListItem.CustomListHeader ->
- /*CustomListHeader(
- onShowCustomListBottomSheet = {
- onUpdateBottomSheetState(
- ShowCustomListsBottomSheet(
- editListEnabled = customLists.isNotEmpty()
- )
- )
- }
- )*/
- customListHeader()
+ RelayListItem.CustomListHeader -> customListHeader()
is RelayListItem.CustomListItem ->
CustomListItem(
listItem,
@@ -103,7 +91,7 @@ fun LazyListScope.relayListContent(
},
)
is RelayListItem.CustomListFooter -> CustomListFooter(listItem)
- RelayListItem.LocationHeader -> locationHeader()//RelayLocationHeader()
+ RelayListItem.LocationHeader -> locationHeader()
is RelayListItem.GeoLocationItem ->
RelayLocationItem(
listItem,
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SearchLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SearchLocationScreen.kt
index 27b9ebcaeb5c..22b7b61fac0c 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SearchLocationScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SearchLocationScreen.kt
@@ -263,7 +263,6 @@ fun SearchLocationScreen(
onRemoveOwnershipFilter = onRemoveOwnershipFilter,
onRemoveProviderFilter = onRemoveProviderFilter,
)
- searchResultTitle(onBackgroundColor = onBackgroundColor)
when (state) {
is SearchSelectLocationUiState.NoQuery -> {
noQuery()
@@ -279,6 +278,18 @@ fun SearchLocationScreen(
onUpdateBottomSheetState = { newSheetState ->
locationBottomSheetState = newSheetState
},
+ customListHeader = {
+ Title(
+ text = stringResource(R.string.custom_lists),
+ onBackgroundColor = onBackgroundColor,
+ )
+ },
+ locationHeader = {
+ Title(
+ text = stringResource(R.string.locations),
+ onBackgroundColor = onBackgroundColor,
+ )
+ },
)
}
}
@@ -343,7 +354,7 @@ private fun SearchBar(
private fun LazyListScope.noQuery() {
item(contentType = ContentType.DESCRIPTION) {
Text(
- text = "Type at least 2 characters to start searching",
+ text = stringResource(R.string.search_query_empty),
style = MaterialTheme.typography.labelMedium,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -360,13 +371,9 @@ private fun LazyListScope.filterRow(
) {
if (filters.isNotEmpty()) {
item {
- Text(
+ Title(
text = stringResource(R.string.filters),
- color = onBackgroundColor,
- modifier =
- Modifier.fillMaxWidth()
- .padding(horizontal = Dimens.sideMargin, vertical = Dimens.smallPadding),
- style = MaterialTheme.typography.labelMedium,
+ onBackgroundColor = onBackgroundColor,
)
}
item {
@@ -380,15 +387,14 @@ private fun LazyListScope.filterRow(
}
}
-private fun LazyListScope.searchResultTitle(onBackgroundColor: Color) {
- item {
- Text(
- text = stringResource(R.string.search_results),
- color = onBackgroundColor,
- modifier =
- Modifier.fillMaxWidth()
- .padding(horizontal = Dimens.sideMargin, vertical = Dimens.smallPadding),
- style = MaterialTheme.typography.labelMedium,
- )
- }
+@Composable
+private fun Title(text: String, onBackgroundColor: Color) {
+ Text(
+ text = text,
+ color = onBackgroundColor,
+ modifier =
+ Modifier.fillMaxWidth()
+ .padding(horizontal = Dimens.sideMargin, vertical = Dimens.smallPadding),
+ style = MaterialTheme.typography.labelMedium,
+ )
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
index dff814bdb6dc..243a1ffa0385 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
@@ -65,7 +65,10 @@ private fun createCustomListSection(
val customListItems =
createCustomListRelayItems(customLists, selectedItem, disabledItem, isExpanded)
addAll(customListItems)
- add(RelayListItem.CustomListFooter(customListItems.isNotEmpty()))
+ // Do not show the footer in the search view
+ if (!isSearching) {
+ add(RelayListItem.CustomListFooter(customListItems.isNotEmpty()))
+ }
}
}
@@ -84,7 +87,8 @@ private fun createCustomListRelayItems(
isSelected = selectedItem == customList.id,
isEnabled =
disabledItem != customList.id &&
- disabledItem != customList.locations.singleOrNull()?.id,
+ customList.locations.singleOrNull()?.id?.let { it != disabledItem } !=
+ false,
expanded = expanded,
)
)
diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml
index 6305fe840379..9fe2ba2a3e0a 100644
--- a/android/lib/resource/src/main/res/values/strings.xml
+++ b/android/lib/resource/src/main/res/values/strings.xml
@@ -240,10 +240,7 @@
WireGuard port
The automatic setting will randomly choose from the valid port ranges shown below.
Search for...
-
- %s.]]>
-
- Try a different search.
+ No result for \"%s\", please try a different search
The custom port can be any value inside the valid ranges: %s.
Custom
Port
@@ -424,4 +421,5 @@
%s (Exit)
Search results
Filters
+ Type at least 2 characters to start searching.