|
@@ -88,6 +88,7 @@ import com.stealthcopter.networktools.ping.PingResult
|
|
|
import com.stealthcopter.networktools.ping.PingStats
|
|
|
import com.vpn.fastestvpnservice.R
|
|
|
import com.vpn.fastestvpnservice.beans.Server
|
|
|
+import com.vpn.fastestvpnservice.beans.ServerDataGlobal
|
|
|
import com.vpn.fastestvpnservice.beans.filterList
|
|
|
import com.vpn.fastestvpnservice.beans.serversListTest
|
|
|
import com.vpn.fastestvpnservice.customItems.CountryItem
|
|
@@ -629,10 +630,38 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
// Log.d("filterServersList", "filterServersList: ${filterServersList.size}")
|
|
|
|
|
|
val countries = serverListViewModelSplash.liveDataGetServersGlobal.observeAsState().value
|
|
|
+ val groupServers = serverListViewModelSplash.liveDataGroupServers.observeAsState().value
|
|
|
+ var countriesFilter = ArrayList<ServerDataGlobal?>()
|
|
|
+ var groupServersFilter = ArrayList<ServerDataGlobal?>()
|
|
|
+
|
|
|
+ if (isAlphabetList.value) {
|
|
|
+ countriesFilter = serversListFinalGlobal as ArrayList
|
|
|
+ countriesFilter.get(selectedTabIndex)?.servers?.sortBy {
|
|
|
+ if (selectedTabIndex == 0) it.country else it.server_name
|
|
|
+ }
|
|
|
+ groupServers?.sortBy {
|
|
|
+ it?.name
|
|
|
+ }
|
|
|
+
|
|
|
+ serverListViewModelSplash.mutableLiveDataGroupServers.value = groupServers
|
|
|
+ } else {
|
|
|
+ if (countries != null) {
|
|
|
+ countriesFilter = countries
|
|
|
+ countriesFilter.get(selectedTabIndex)?.servers?.sortByDescending {
|
|
|
+ it.totalServers
|
|
|
+ }
|
|
|
+
|
|
|
+ groupServers?.sortByDescending {
|
|
|
+ it?.totalServers
|
|
|
+ }
|
|
|
+
|
|
|
+ serverListViewModelSplash.mutableLiveDataGroupServers.value = groupServers
|
|
|
+ }
|
|
|
+ }
|
|
|
when (selectedTabIndex) {
|
|
|
0 -> {
|
|
|
LazyColumn() {
|
|
|
- countries?.get(selectedTabIndex)?.servers?.let {
|
|
|
+ countriesFilter?.get(selectedTabIndex)?.servers?.let {
|
|
|
itemsIndexed(items = it, itemContent = {index, country ->
|
|
|
CountryItem(server = country, "servers", country.totalServers, navHostController, index)
|
|
|
})
|
|
@@ -641,7 +670,7 @@ fun ColumnScope.ShowAllLocationsList(
|
|
|
}
|
|
|
else -> {
|
|
|
LazyColumn() {
|
|
|
- countries?.get(selectedTabIndex)?.servers?.let {
|
|
|
+ countriesFilter?.get(selectedTabIndex)?.servers?.let {
|
|
|
items(items = it, itemContent = {country ->
|
|
|
ServerItem(server = country, navHostController, country.ping)
|
|
|
})
|