瀏覽代碼

navigating to TV server list screen by click on 'Change' Button

Khubaib 9 月之前
父節點
當前提交
5331e1377c

+ 2 - 2
.idea/deploymentTargetSelector.xml

@@ -4,10 +4,10 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2024-07-10T12:28:25.511492595Z">
+        <DropdownSelection timestamp="2024-07-10T13:43:28.290813007Z">
           <Target type="DEFAULT_BOOT">
             <handle>
-              <DeviceId pluginId="LocalEmulator" identifier="path=/home/ubuntu/.android/avd/Television_1080p_API_31.avd" />
+              <DeviceId pluginId="Default" identifier="serial=192.168.110.84:5555;connection=9dc6ebf4" />
             </handle>
           </Target>
         </DropdownSelection>

+ 4 - 16
app/src/main/java/com/vpn/fastestvpnservice/screensTV/HomeScreenTV.kt

@@ -785,11 +785,9 @@ fun BoxScope.AddRowSmartTV(
                         isButtonFocused = it.isFocused
                     }
                     .clickable {
-//                        Toast
-//                            .makeText(
-//                                context, "Change Pressed()", Toast.LENGTH_SHORT
-//                            )
-//                            .show()
+                        navHostController.navigate(
+                            ScreenTV.ServerListTV.route
+                        )
                     }
                     .focusable()
                 ,
@@ -799,17 +797,7 @@ fun BoxScope.AddRowSmartTV(
                     color = if (isButtonFocused) colorResource(id = R.color.maroon_text) else colorResource(id = R.color.blue_text),
                     fontSize = if (isTablet()) 20.sp else 14.sp
                 ),
-                onClick = {
-//                    Toast.makeText(
-//                        context, "Change Clicked()", Toast.LENGTH_SHORT
-//                    ).show()
-//                    toChangeServer.value = true
-//                    navHostController.navigate(
-//                        Screen.ServerList.route
-//                    )
-//                    Screen.ServerList.isTrue = false
-//                    Log.d("button_click_change", "Pressed")
-                },
+                onClick = {},
             )
         }
     }

+ 11 - 4
app/src/main/java/com/vpn/fastestvpnservice/viewmodels/ServerListViewModel.kt

@@ -216,9 +216,9 @@ class ServerListViewModel(context: Context): ViewModel() {
                     val servers = serverListViewModelSplash.filterServersWithTvCountries(it)
                     serversListGlobal.add(index, ServerDataGlobal(serverData.name, servers))
 
-                    servers.forEachIndexed { index, server ->
-                        getServerGroupList(server, it, index)
-                    }
+//                    servers.forEachIndexed { index, server ->
+//                        getServerGroupList(server, it, index)
+//                    }
 
                 }
             } else {
@@ -257,7 +257,8 @@ class ServerListViewModel(context: Context): ViewModel() {
         )
     }
 
-    fun filterServersByISO(serverlist: ArrayList<Server>, isAlphabetList: Boolean = false): ArrayList<Server> {
+    fun filterServersByISO(serverlist: ArrayList<Server>,
+                           isAlphabetList: Boolean = false): ArrayList<Server> {
 
         serverlist.sortWith(Comparator { s1, s2 ->
             return@Comparator s1.country_sort.compareTo(s2.country_sort)
@@ -418,6 +419,9 @@ class ServerListViewModel(context: Context): ViewModel() {
                 if (entry.key == value.country) {
                     distinctBy.get(index).totalServers = entry.value.sumBy { it.totalServers }
                 }
+                calculatePing(value) {
+                    distinctBy.get(index).ping = it
+                }
             }
         }
 
@@ -506,6 +510,9 @@ class ServerListViewModel(context: Context): ViewModel() {
             for ((index, value) in distinctBy.withIndex()) {
                 if (entry.key == value.country) {
                     distinctBy.get(index).totalServers = entry.value.sumBy { it.totalServers }
+                    calculatePing(value) {
+                        distinctBy.get(index).ping = it
+                    }
                 }
             }
         }