|
@@ -1,6 +1,7 @@
|
|
|
package com.vpn.fastestvpnservice.screens
|
|
|
|
|
|
import android.app.Activity
|
|
|
+import android.content.Context
|
|
|
import android.content.res.Configuration
|
|
|
import android.util.Log
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
@@ -141,18 +142,18 @@ fun ServerList(
|
|
|
window.statusBarColor = Color.Transparent.toArgb()
|
|
|
window.navigationBarColor = Color.Transparent.toArgb()
|
|
|
|
|
|
- HeaderRowSL(navHostController = navHostController)
|
|
|
+ HeaderRowSL(navHostController = navHostController, context)
|
|
|
Column(
|
|
|
modifier = Modifier
|
|
|
.padding(horizontal = 16.dp)
|
|
|
.padding(top = 35.dp)
|
|
|
.background(Color.Transparent)
|
|
|
) {
|
|
|
- ShowSearchBar(serverListViewModel, basePreferenceHelper, navHostController)
|
|
|
+ ShowSearchBar(serverListViewModel, basePreferenceHelper, navHostController, context)
|
|
|
|
|
|
val currentPageIndex = if (Screen.ServerList.isTrue) 1 else 0
|
|
|
val scope = rememberCoroutineScope()
|
|
|
- val serverTabItems = listOf("Recommended", "All Locations")
|
|
|
+ val serverTabItems = listOf(context.getString(R.string.recommended), context.getString(R.string.all_locations))
|
|
|
val pagerState = rememberPagerState(initialPage = currentPageIndex, pageCount = {serverTabItems.size})
|
|
|
val selectedIndex by remember { derivedStateOf { pagerState.currentPage } }
|
|
|
|
|
@@ -236,7 +237,7 @@ fun ServerList(
|
|
|
.padding(top = 0.dp, bottom = 10.dp)
|
|
|
) {
|
|
|
if (page == 0) {
|
|
|
- ShowRecommendedList(serverListViewModel, basePreferenceHelper, navHostController)
|
|
|
+ ShowRecommendedList(serverListViewModel, basePreferenceHelper, navHostController, context)
|
|
|
}
|
|
|
else if (page == 1) {
|
|
|
ShowAllLocationsList(serverListViewModel, basePreferenceHelper, navHostController)
|
|
@@ -250,7 +251,7 @@ fun ServerList(
|
|
|
|
|
|
@Composable
|
|
|
fun BoxScope.HeaderRowSL(
|
|
|
- navHostController: NavHostController) {
|
|
|
+ navHostController: NavHostController, context: Context) {
|
|
|
IconButton(
|
|
|
onClick = {
|
|
|
navHostController.popBackStack()
|
|
@@ -277,7 +278,7 @@ fun BoxScope.HeaderRowSL(
|
|
|
.padding(5.dp),
|
|
|
color = colorResource(id = R.color.transparent)
|
|
|
) {
|
|
|
- Text(text = "Select Location",
|
|
|
+ Text(text = context.getString(R.string.select_location),
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
modifier = Modifier.fillMaxHeight()
|
|
@@ -290,7 +291,8 @@ fun BoxScope.HeaderRowSL(
|
|
|
fun ColumnScope.ShowRecommendedList(
|
|
|
serverListViewModel: ServerListViewModel,
|
|
|
prefHelper: BasePreferenceHelper,
|
|
|
- navHostController: NavHostController
|
|
|
+ navHostController: NavHostController,
|
|
|
+ context: Context
|
|
|
) {
|
|
|
CompositionLocalProvider(
|
|
|
LocalOverscrollConfiguration provides null
|
|
@@ -330,7 +332,7 @@ fun ColumnScope.ShowRecommendedList(
|
|
|
.padding(bottom = 0.dp)
|
|
|
.size(19.dp)
|
|
|
)
|
|
|
- Text(text = "Favorite Location",
|
|
|
+ Text(text = context.getString(R.string.favorite_location),
|
|
|
style = MaterialTheme.typography.titleSmall,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
modifier = Modifier
|
|
@@ -375,7 +377,7 @@ fun ColumnScope.ShowRecommendedList(
|
|
|
.padding(bottom = 0.dp)
|
|
|
.size(19.dp)
|
|
|
)
|
|
|
- Text(text = "Smart Location",
|
|
|
+ Text(text = context.getString(R.string.smart_location),
|
|
|
style = MaterialTheme.typography.titleSmall,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
modifier = Modifier
|
|
@@ -407,7 +409,7 @@ fun ColumnScope.ShowRecommendedList(
|
|
|
.padding(bottom = 0.dp)
|
|
|
.size(19.dp)
|
|
|
)
|
|
|
- Text(text = "Recent Location",
|
|
|
+ Text(text = context.getString(R.string.recent_location),
|
|
|
style = MaterialTheme.typography.titleSmall,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
modifier = Modifier
|
|
@@ -447,7 +449,7 @@ fun ColumnScope.ShowRecommendedList(
|
|
|
.padding(bottom = 0.dp)
|
|
|
.size(19.dp)
|
|
|
)
|
|
|
- Text(text = "Recommended Location",
|
|
|
+ Text(text = context.getString(R.string.recommended_location),
|
|
|
style = MaterialTheme.typography.titleSmall,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
modifier = Modifier
|
|
@@ -771,7 +773,8 @@ fun ColumnScope.ShowHeaderItem(
|
|
|
fun ColumnScope.ShowSearchBar(
|
|
|
serverListViewModel: ServerListViewModel,
|
|
|
basePreferenceHelper: BasePreferenceHelper,
|
|
|
- navHostController: NavHostController) {
|
|
|
+ navHostController: NavHostController,
|
|
|
+ context: Context) {
|
|
|
// var isActive by remember { mutableStateOf(false) }
|
|
|
// val searchText = searchListViewModel.searchText.collectAsState().value
|
|
|
|
|
@@ -817,7 +820,7 @@ fun ColumnScope.ShowSearchBar(
|
|
|
},
|
|
|
placeholder = {
|
|
|
Text(
|
|
|
- text = "Search Location",
|
|
|
+ text = context.getString(R.string.search_location),
|
|
|
style = MaterialTheme.typography.displaySmall,
|
|
|
color = MaterialTheme.colorScheme.primary
|
|
|
)
|
|
@@ -902,7 +905,7 @@ fun ColumnScope.ShowSearchBar(
|
|
|
horizontalAlignment = Alignment.Start
|
|
|
) {
|
|
|
AddTextSettings(
|
|
|
- text = "Sort By",
|
|
|
+ text = context.getString(R.string.sort_by),
|
|
|
size = 18.sp,
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
bottomPadding = 20.dp,
|
|
@@ -910,6 +913,15 @@ fun ColumnScope.ShowSearchBar(
|
|
|
style = MaterialTheme.typography.titleMedium
|
|
|
)
|
|
|
filterList.forEach { filter ->
|
|
|
+ var filterListLingual: String = ""
|
|
|
+ when (filter) {
|
|
|
+ filterList[0] -> {
|
|
|
+ filterListLingual = context.getString(R.string.popularity)
|
|
|
+ }
|
|
|
+ filterList[1] -> {
|
|
|
+ filterListLingual = context.getString(R.string.alphabetically)
|
|
|
+ }
|
|
|
+ }
|
|
|
Row(
|
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
@@ -939,7 +951,7 @@ fun ColumnScope.ShowSearchBar(
|
|
|
selectedColor = colorResource(id = R.color.radio_button_blue),
|
|
|
unselectedColor = colorResource(id = R.color.gray_icon)),
|
|
|
)
|
|
|
- Text(text = filter,
|
|
|
+ Text(text = filterListLingual,
|
|
|
modifier = Modifier.padding(start = 12.dp),
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
style = MaterialTheme.typography.bodySmall
|