|
@@ -2,16 +2,11 @@ package com.vpn.fastestvpnservice.screens
|
|
|
|
|
|
import android.content.res.Configuration
|
|
|
import android.util.Log
|
|
|
-import android.widget.Toast
|
|
|
import androidx.compose.animation.Animatable
|
|
|
-import androidx.compose.animation.core.animateFloatAsState
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
import androidx.compose.foundation.LocalOverscrollConfiguration
|
|
|
import androidx.compose.foundation.background
|
|
|
-import androidx.compose.foundation.clickable
|
|
|
-import androidx.compose.foundation.gestures.Orientation
|
|
|
import androidx.compose.foundation.gestures.detectTapGestures
|
|
|
-import androidx.compose.foundation.gestures.scrollable
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.BoxScope
|
|
@@ -24,39 +19,28 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
import androidx.compose.foundation.layout.height
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
-import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
-import androidx.compose.foundation.layout.wrapContentWidth
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
import androidx.compose.foundation.pager.HorizontalPager
|
|
|
import androidx.compose.foundation.pager.rememberPagerState
|
|
|
-import androidx.compose.foundation.rememberScrollState
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
-import androidx.compose.foundation.verticalScroll
|
|
|
-import androidx.compose.material.Icon
|
|
|
-import androidx.compose.material.IconButton
|
|
|
-import androidx.compose.material.Surface
|
|
|
-import androidx.compose.material.Tab
|
|
|
-import androidx.compose.material.TabRowDefaults
|
|
|
-import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
|
|
|
-import androidx.compose.material.Text
|
|
|
-import androidx.compose.material.TopAppBar
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|
|
-import androidx.compose.material.icons.filled.FileDownload
|
|
|
-import androidx.compose.material.icons.filled.FilterList
|
|
|
-import androidx.compose.material.icons.outlined.FilterList
|
|
|
-import androidx.compose.material3.DockedSearchBar
|
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
+import androidx.compose.material3.Icon
|
|
|
+import androidx.compose.material3.IconButton
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.ModalBottomSheet
|
|
|
import androidx.compose.material3.RadioButton
|
|
|
import androidx.compose.material3.RadioButtonDefaults
|
|
|
import androidx.compose.material3.SearchBar
|
|
|
import androidx.compose.material3.SearchBarDefaults
|
|
|
-import androidx.compose.material3.ShapeDefaults
|
|
|
+import androidx.compose.material3.Surface
|
|
|
+import androidx.compose.material3.Tab
|
|
|
import androidx.compose.material3.TabRow
|
|
|
+import androidx.compose.material3.TabRowDefaults
|
|
|
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
|
|
|
+import androidx.compose.material3.Text
|
|
|
import androidx.compose.material3.TextFieldDefaults
|
|
|
import androidx.compose.material3.rememberModalBottomSheetState
|
|
|
import androidx.compose.runtime.Composable
|
|
@@ -76,36 +60,24 @@ import androidx.compose.ui.unit.sp
|
|
|
import androidx.navigation.NavHostController
|
|
|
import androidx.navigation.compose.rememberNavController
|
|
|
import androidx.compose.runtime.*
|
|
|
+import androidx.compose.runtime.livedata.observeAsState
|
|
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
|
import androidx.compose.ui.draw.alpha
|
|
|
import androidx.compose.ui.draw.clip
|
|
|
-import androidx.compose.ui.draw.rotate
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
-import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalFocusManager
|
|
|
-import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
-import androidx.lifecycle.ViewModelProvider
|
|
|
-import androidx.lifecycle.viewmodel.ViewModelFactoryDsl
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
|
import com.vpn.fastestvpnservice.R
|
|
|
-import com.vpn.fastestvpnservice.beans.Server
|
|
|
-import com.vpn.fastestvpnservice.beans.allLocationsList
|
|
|
-import com.vpn.fastestvpnservice.beans.dvpnList
|
|
|
-import com.vpn.fastestvpnservice.beans.favList
|
|
|
-import com.vpn.fastestvpnservice.beans.p2pList
|
|
|
-import com.vpn.fastestvpnservice.beans.recentList
|
|
|
-import com.vpn.fastestvpnservice.beans.recommendedList
|
|
|
-import com.vpn.fastestvpnservice.beans.smartList
|
|
|
-import com.vpn.fastestvpnservice.beans.streamingList
|
|
|
import com.vpn.fastestvpnservice.customItems.CountryItem
|
|
|
import com.vpn.fastestvpnservice.customItems.ServerItem
|
|
|
import com.vpn.fastestvpnservice.customItems.ServerSearchItem
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.AddTextSettings
|
|
|
import com.vpn.fastestvpnservice.sealedClass.Screen
|
|
|
+import com.vpn.fastestvpnservice.viewmodels.SearchListViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.ServerListViewModel
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
@@ -137,7 +109,7 @@ fun ServerList(
|
|
|
.padding(horizontal = 16.dp)
|
|
|
.padding(top = 100.dp)
|
|
|
) {
|
|
|
- ShowSearchBar()
|
|
|
+ ShowSearchBar(serverListViewModel, basePreferenceHelper)
|
|
|
|
|
|
val serverTabItems = listOf("Recommended", "All Locations")
|
|
|
val pagerState = rememberPagerState(pageCount = {serverTabItems.size})
|
|
@@ -152,6 +124,7 @@ fun ServerList(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Tab Row [Recommended, All Locations]
|
|
|
TabRow(
|
|
|
selectedTabIndex = selectedIndex,
|
|
|
containerColor = Color.White,
|
|
@@ -213,20 +186,26 @@ fun ServerList(
|
|
|
modifier = Modifier
|
|
|
.padding(top = 14.dp)
|
|
|
.fillMaxWidth()
|
|
|
- .background(Color.Transparent)
|
|
|
+ .background(Color.Transparent),
|
|
|
+ userScrollEnabled = false
|
|
|
) { page ->
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .padding(top = 0.dp, bottom = 10.dp)
|
|
|
+ CompositionLocalProvider(
|
|
|
+ LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
|
- if (page == 0) {
|
|
|
- ShowRecommendedList()
|
|
|
- }
|
|
|
- else if (page == 1) {
|
|
|
- ShowAllLocationsList(serverListViewModel, basePreferenceHelper)
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .padding(top = 0.dp, bottom = 10.dp)
|
|
|
+ ) {
|
|
|
+ if (page == 0) {
|
|
|
+ ShowRecommendedList(serverListViewModel, basePreferenceHelper)
|
|
|
+ }
|
|
|
+ else if (page == 1) {
|
|
|
+ ShowAllLocationsList(serverListViewModel, basePreferenceHelper)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -276,7 +255,10 @@ fun BoxScope.HeaderRowSL(
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
@Composable
|
|
|
-fun ColumnScope.ShowRecommendedList() {
|
|
|
+fun ColumnScope.ShowRecommendedList(
|
|
|
+ serverListViewModel: ServerListViewModel,
|
|
|
+ basePreferenceHelper: BasePreferenceHelper
|
|
|
+) {
|
|
|
CompositionLocalProvider(
|
|
|
LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
@@ -313,10 +295,15 @@ fun ColumnScope.ShowRecommendedList() {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
- for (i in 1..1) {
|
|
|
- items(items = favList) { server ->
|
|
|
- ServerItem(server)
|
|
|
+ val fav = basePreferenceHelper.getServerData()
|
|
|
+ val filterData1 = fav.get(1).servers?.let {
|
|
|
+ serverListViewModel.filterServersByStreamingServers(
|
|
|
+ it
|
|
|
+ )
|
|
|
}
|
|
|
+
|
|
|
+ items(items = filterData1!!) { server ->
|
|
|
+ ServerItem(server)
|
|
|
}
|
|
|
|
|
|
/* Smart List */
|
|
@@ -348,7 +335,15 @@ fun ColumnScope.ShowRecommendedList() {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
- items(items = smartList) { server ->
|
|
|
+
|
|
|
+ val smart = basePreferenceHelper.getServerData()
|
|
|
+ val filterData2 = smart.get(1).servers?.let {
|
|
|
+ serverListViewModel.filterServersByStreamingServers(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ items(items = filterData2!!) { server ->
|
|
|
ServerItem(server)
|
|
|
}
|
|
|
|
|
@@ -382,7 +377,14 @@ fun ColumnScope.ShowRecommendedList() {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
- items(items = recentList) { server ->
|
|
|
+ val recent = basePreferenceHelper.getServerData()
|
|
|
+ val filterData3 = recent.get(1).servers?.let {
|
|
|
+ serverListViewModel.filterServersByStreamingServers(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ items(items = filterData3!!) { server ->
|
|
|
ServerItem(server)
|
|
|
}
|
|
|
|
|
@@ -416,7 +418,15 @@ fun ColumnScope.ShowRecommendedList() {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
- items(items = recommendedList) { server ->
|
|
|
+
|
|
|
+ val recommend = basePreferenceHelper.getServerData()
|
|
|
+ val filterData4 = recommend.get(1).servers?.let {
|
|
|
+ serverListViewModel.filterServersByStreamingServers(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ items(items = filterData4!!) { server ->
|
|
|
ServerItem(server)
|
|
|
}
|
|
|
}
|
|
@@ -437,7 +447,18 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
val selectedIndex by remember { derivedStateOf { pagerState.currentPage } }
|
|
|
val scope = rememberCoroutineScope()
|
|
|
|
|
|
- TabRow(
|
|
|
+ val country = basePreferenceHelper.getServerData()
|
|
|
+ val filterData = country.get(0).servers?.let {
|
|
|
+ serverListViewModel.filterServersByISO(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ country.forEachIndexed { index, server ->
|
|
|
+ Log.d("test_data", server.name.toString())
|
|
|
+ }
|
|
|
+
|
|
|
+ androidx.compose.material3.ScrollableTabRow(
|
|
|
selectedTabIndex = selectedIndex,
|
|
|
containerColor = Color.Transparent,
|
|
|
modifier = Modifier
|
|
@@ -446,6 +467,7 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
.background(Color.Transparent)
|
|
|
.clip(RoundedCornerShape(0.dp))
|
|
|
.height(68.dp),
|
|
|
+ edgePadding = 0.dp,
|
|
|
indicator = { selectedTab ->
|
|
|
TabRowDefaults.Indicator(
|
|
|
modifier = Modifier.tabIndicatorOffset(selectedTab[selectedIndex]),
|
|
@@ -504,77 +526,69 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
var isDvpnExpanded by rememberSaveable { mutableStateOf(true) }
|
|
|
var isP2PExpanded by rememberSaveable { mutableStateOf(true) }
|
|
|
|
|
|
- val rotationState by animateFloatAsState(
|
|
|
- targetValue = if (isCountriesExpanded) 180f else 0f,
|
|
|
- label = if (isCountriesExpanded) "Show Less" else "Show More"
|
|
|
- )
|
|
|
- val rotationState2 by animateFloatAsState(
|
|
|
- targetValue = if (isStreamingExpanded) 180f else 0f,
|
|
|
- label = if (isStreamingExpanded) "Show Less" else "Show More"
|
|
|
- )
|
|
|
- val rotationState3 by animateFloatAsState(
|
|
|
- targetValue = if (isDvpnExpanded) 180f else 0f,
|
|
|
- label = if (isDvpnExpanded) "Show Less" else "Show More"
|
|
|
- )
|
|
|
- val rotationState4 by animateFloatAsState(
|
|
|
- targetValue = if (isP2PExpanded) 180f else 0f,
|
|
|
- label = if (isP2PExpanded) "Show Less" else "Show More"
|
|
|
- )
|
|
|
+// val rotationState by animateFloatAsState(
|
|
|
+// targetValue = if (isCountriesExpanded) 180f else 0f,
|
|
|
+// label = if (isCountriesExpanded) "Show Less" else "Show More"
|
|
|
+// )
|
|
|
|
|
|
HorizontalPager(
|
|
|
state = pagerState,
|
|
|
modifier = Modifier
|
|
|
.padding(top = 16.dp)
|
|
|
.fillMaxWidth()
|
|
|
- .background(Color.Transparent)
|
|
|
+ .background(Color.Transparent),
|
|
|
+ userScrollEnabled = false
|
|
|
) { serverTabPager ->
|
|
|
- Column(
|
|
|
- modifier = Modifier.fillMaxSize()
|
|
|
+ CompositionLocalProvider(
|
|
|
+ LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
|
- var serverTitle by rememberSaveable { mutableStateOf("") }
|
|
|
- var icon by rememberSaveable { mutableStateOf(0) }
|
|
|
-
|
|
|
- when (serverTabPager) {
|
|
|
- 0 -> {
|
|
|
- serverTitle = allLocationsTabItems[0]
|
|
|
- icon = if (isCountriesExpanded) R.drawable.dragarrow3x
|
|
|
- else R.drawable.downarrow3x
|
|
|
- }
|
|
|
- 1 -> {
|
|
|
- serverTitle = allLocationsTabItems[1]
|
|
|
- icon = if (isStreamingExpanded) R.drawable.dragarrow3x
|
|
|
- else R.drawable.downarrow3x
|
|
|
- }
|
|
|
- 2 -> {
|
|
|
- serverTitle = allLocationsTabItems[2]
|
|
|
- icon = if (isDvpnExpanded) R.drawable.dragarrow3x
|
|
|
- else R.drawable.downarrow3x
|
|
|
- }
|
|
|
- 3 -> {
|
|
|
- serverTitle = allLocationsTabItems[3]
|
|
|
- icon = if (isP2PExpanded) R.drawable.dragarrow3x
|
|
|
- else R.drawable.downarrow3x
|
|
|
- }
|
|
|
- }
|
|
|
+ Column(
|
|
|
+ modifier = Modifier.fillMaxSize()
|
|
|
+ ) {
|
|
|
+ var serverTitle by rememberSaveable { mutableStateOf("") }
|
|
|
+ var icon by rememberSaveable { mutableStateOf(0) }
|
|
|
|
|
|
- ShowHeaderItem(serverTitle, icon, serverTabPager) {
|
|
|
when (serverTabPager) {
|
|
|
0 -> {
|
|
|
- isCountriesExpanded = !isCountriesExpanded
|
|
|
+ serverTitle = allLocationsTabItems[0]
|
|
|
+ icon = if (isCountriesExpanded) R.drawable.dragarrow3x
|
|
|
+ else R.drawable.downarrow3x
|
|
|
}
|
|
|
1 -> {
|
|
|
- isStreamingExpanded = !isStreamingExpanded
|
|
|
+ serverTitle = allLocationsTabItems[1]
|
|
|
+ icon = if (isStreamingExpanded) R.drawable.dragarrow3x
|
|
|
+ else R.drawable.downarrow3x
|
|
|
}
|
|
|
2 -> {
|
|
|
- isDvpnExpanded = !isDvpnExpanded
|
|
|
+ serverTitle = allLocationsTabItems[2]
|
|
|
+ icon = if (isDvpnExpanded) R.drawable.dragarrow3x
|
|
|
+ else R.drawable.downarrow3x
|
|
|
}
|
|
|
3 -> {
|
|
|
- isP2PExpanded = !isP2PExpanded
|
|
|
+ serverTitle = allLocationsTabItems[3]
|
|
|
+ icon = if (isP2PExpanded) R.drawable.dragarrow3x
|
|
|
+ else R.drawable.downarrow3x
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ShowHeaderItem(serverTitle, icon, serverTabPager) {
|
|
|
+ when (serverTabPager) {
|
|
|
+ 0 -> {
|
|
|
+ isCountriesExpanded = !isCountriesExpanded
|
|
|
+ }
|
|
|
+ 1 -> {
|
|
|
+ isStreamingExpanded = !isStreamingExpanded
|
|
|
+ }
|
|
|
+ 2 -> {
|
|
|
+ isDvpnExpanded = !isDvpnExpanded
|
|
|
+ }
|
|
|
+ 3 -> {
|
|
|
+ isP2PExpanded = !isP2PExpanded
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- when (serverTabPager) {
|
|
|
+ when (serverTabPager) {
|
|
|
0 -> {
|
|
|
if (isCountriesExpanded) {
|
|
|
CompositionLocalProvider(
|
|
@@ -586,10 +600,9 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
it
|
|
|
)
|
|
|
}
|
|
|
- Log.d("test_country_list", filterData?.get(0)?.country.toString() + " " + filterData?.size)
|
|
|
|
|
|
LazyColumn() {
|
|
|
- items(items = allLocationsList) { country ->
|
|
|
+ items(items = filterData!!) { country ->
|
|
|
CountryItem(server = country)
|
|
|
}
|
|
|
}
|
|
@@ -602,9 +615,14 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
CompositionLocalProvider(
|
|
|
LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
|
-
|
|
|
+ val streaming = basePreferenceHelper.getServerData()
|
|
|
+ val filterData = streaming.get(1).servers?.let {
|
|
|
+ serverListViewModel.filterServersByStreamingServers(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
LazyColumn() {
|
|
|
- items(items = streamingList) { streaming ->
|
|
|
+ items(items = filterData!!) { streaming ->
|
|
|
ServerItem(server = streaming)
|
|
|
}
|
|
|
}
|
|
@@ -616,8 +634,15 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
CompositionLocalProvider(
|
|
|
LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
|
+ val dvpn = basePreferenceHelper.getServerData()
|
|
|
+ val filterData = dvpn.get(2).servers?.let {
|
|
|
+ serverListViewModel.filterServersByISO(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
LazyColumn() {
|
|
|
- items(items = dvpnList) { dvpn ->
|
|
|
+ items(items = filterData!!) { dvpn ->
|
|
|
ServerItem(server = dvpn)
|
|
|
}
|
|
|
}
|
|
@@ -630,8 +655,15 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
CompositionLocalProvider(
|
|
|
LocalOverscrollConfiguration provides null
|
|
|
) {
|
|
|
+ val p2p = basePreferenceHelper.getServerData()
|
|
|
+ val filterData = p2p.get(3).servers?.let {
|
|
|
+ serverListViewModel.filterServersByISO(
|
|
|
+ it
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
LazyColumn() {
|
|
|
- items(items = p2pList) { p2p ->
|
|
|
+ items(items = filterData!!) { p2p ->
|
|
|
ServerItem(server = p2p)
|
|
|
}
|
|
|
}
|
|
@@ -639,7 +671,9 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -717,27 +751,37 @@ fun ColumnScope.ShowHeaderItem(
|
|
|
|
|
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
|
|
@Composable
|
|
|
-fun ColumnScope.ShowSearchBar() {
|
|
|
- var searchText by remember { mutableStateOf("") }
|
|
|
- var isActive by remember { mutableStateOf(false) }
|
|
|
+fun ColumnScope.ShowSearchBar(
|
|
|
+ serverListViewModel: ServerListViewModel,
|
|
|
+ basePreferenceHelper: BasePreferenceHelper) {
|
|
|
+
|
|
|
+ val context = LocalContext.current
|
|
|
+ val searchListViewModel: SearchListViewModel = viewModel{
|
|
|
+ SearchListViewModel(context, serverListViewModel)
|
|
|
+ }
|
|
|
+
|
|
|
+// var searchText by remember { mutableStateOf("") }
|
|
|
+// var isActive by remember { mutableStateOf(false) }
|
|
|
+
|
|
|
+ val searchText = searchListViewModel.searchText.observeAsState().value
|
|
|
+ val isActive = searchListViewModel.isActive.observeAsState().value
|
|
|
|
|
|
var isFilter by remember { mutableStateOf(false) }
|
|
|
val sheetState = rememberModalBottomSheetState()
|
|
|
val filterList = listOf("Popularity", "Alphabetically")
|
|
|
var selectedFilterList by remember { mutableStateOf(filterList[0]) }
|
|
|
- val context = LocalContext.current
|
|
|
|
|
|
SearchBar(
|
|
|
- query = searchText,
|
|
|
+ query = searchText!!,
|
|
|
onQueryChange = {
|
|
|
- searchText = it
|
|
|
+ searchListViewModel.searchTextChange(it)
|
|
|
},
|
|
|
onSearch = {
|
|
|
- isActive = false
|
|
|
+ searchListViewModel.isActiveChange(false)
|
|
|
},
|
|
|
- active = isActive,
|
|
|
+ active = isActive!!,
|
|
|
onActiveChange = {
|
|
|
- isActive = it
|
|
|
+ searchListViewModel.isActiveChange(it)
|
|
|
},
|
|
|
placeholder = {
|
|
|
Text(
|
|
@@ -775,7 +819,11 @@ fun ColumnScope.ShowSearchBar() {
|
|
|
dividerColor = Color.Transparent,
|
|
|
inputFieldColors = TextFieldDefaults.colors(
|
|
|
focusedTextColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
- unfocusedTextColor = colorResource(id = R.color.dark_blue_gray_text)
|
|
|
+ unfocusedTextColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
+ unfocusedIndicatorColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
+ focusedIndicatorColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
+ disabledIndicatorColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
+ cursorColor = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
)
|
|
|
),
|
|
|
modifier = Modifier
|
|
@@ -788,10 +836,9 @@ fun ColumnScope.ShowSearchBar() {
|
|
|
modifier = Modifier
|
|
|
.padding(top = 0.dp, bottom = 0.dp),
|
|
|
) {
|
|
|
- for (i in 1..20) {
|
|
|
- items(items = favList) { server ->
|
|
|
- ServerSearchItem(server)
|
|
|
- }
|
|
|
+ val searchServersList = searchListViewModel.countriesList.value
|
|
|
+ items(items = searchServersList!!) { server ->
|
|
|
+ ServerSearchItem(server)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -866,7 +913,6 @@ fun ColumnScope.ShowSearchBar() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
|
|
@Composable
|
|
|
fun ServerListPreview() {
|