|
@@ -96,7 +96,6 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
val splashViewModel: SplashViewModel = viewModel{
|
|
val splashViewModel: SplashViewModel = viewModel{
|
|
SplashViewModel(context)
|
|
SplashViewModel(context)
|
|
}
|
|
}
|
|
-
|
|
|
|
val scope = rememberCoroutineScope()
|
|
val scope = rememberCoroutineScope()
|
|
val homeViewModel: HomeViewModel = viewModel {
|
|
val homeViewModel: HomeViewModel = viewModel {
|
|
HomeViewModel(context, scope)
|
|
HomeViewModel(context, scope)
|
|
@@ -104,7 +103,6 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
var isCountryServerClicked by remember {
|
|
var isCountryServerClicked by remember {
|
|
mutableStateOf(false)
|
|
mutableStateOf(false)
|
|
}
|
|
}
|
|
-
|
|
|
|
if (isCountryServerClicked) {
|
|
if (isCountryServerClicked) {
|
|
Log.d("ServerCallbacks", "isServerClicked $isCountryServerClicked")
|
|
Log.d("ServerCallbacks", "isServerClicked $isCountryServerClicked")
|
|
onServer.onServerSelected(context, homeViewModel,
|
|
onServer.onServerSelected(context, homeViewModel,
|
|
@@ -114,11 +112,9 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
)
|
|
)
|
|
navHostController.popBackStack()
|
|
navHostController.popBackStack()
|
|
}
|
|
}
|
|
-
|
|
|
|
var isServerServerClicked by remember {
|
|
var isServerServerClicked by remember {
|
|
mutableStateOf(false)
|
|
mutableStateOf(false)
|
|
}
|
|
}
|
|
-
|
|
|
|
if (isServerServerClicked) {
|
|
if (isServerServerClicked) {
|
|
Log.d("ServerCallbacks", "isServerClicked $isServerServerClicked")
|
|
Log.d("ServerCallbacks", "isServerClicked $isServerServerClicked")
|
|
onServer.onServerSelected(
|
|
onServer.onServerSelected(
|
|
@@ -131,32 +127,15 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
navHostController.popBackStack()
|
|
navHostController.popBackStack()
|
|
}
|
|
}
|
|
|
|
|
|
-// Log.d("test_countrySize", "countrySize $countrySize")
|
|
|
|
-
|
|
|
|
-// LaunchedEffect(key1 = Unit) {
|
|
|
|
-// Log.d("test_countrySize", "countrySize LE() $countrySize")
|
|
|
|
-// if (countrySize == 0) {
|
|
|
|
-// Log.d("test_countrySize", "countrySize==0 $countrySize")
|
|
|
|
-// countrySize = server.totalServers
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
countrySize.let { size ->
|
|
countrySize.let { size ->
|
|
if (size > 1) {
|
|
if (size > 1) {
|
|
var locationsSize: Int = 0
|
|
var locationsSize: Int = 0
|
|
-// server.totalServers.let {
|
|
|
|
-// locationsSize = it
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
val countriesServersData = basePreferenceHelper.getServerData().get(0).servers
|
|
val countriesServersData = basePreferenceHelper.getServerData().get(0).servers
|
|
countriesServersData?.let {
|
|
countriesServersData?.let {
|
|
val serversGroup = serverListViewModel.getServerGroupList(server, it)
|
|
val serversGroup = serverListViewModel.getServerGroupList(server, it)
|
|
// Log.d("test_compose_servers", "${server.server_name} = ${serversGroup.size}")
|
|
// Log.d("test_compose_servers", "${server.server_name} = ${serversGroup.size}")
|
|
locationsSize = serversGroup.size
|
|
locationsSize = serversGroup.size
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- Log.d("test_server_size", "${server.server_name} $locationsSize")
|
|
|
|
Column {
|
|
Column {
|
|
/* Country Location's Row */
|
|
/* Country Location's Row */
|
|
Row(
|
|
Row(
|
|
@@ -205,7 +184,7 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
.align(Alignment.CenterVertically)
|
|
.align(Alignment.CenterVertically)
|
|
)
|
|
)
|
|
Spacer(modifier = Modifier.weight(1F))
|
|
Spacer(modifier = Modifier.weight(1F))
|
|
- Text(text = "${locationsSize} locations",
|
|
|
|
|
|
+ Text(text = "$locationsSize locations",
|
|
style = MaterialTheme.typography.bodySmall,
|
|
style = MaterialTheme.typography.bodySmall,
|
|
color = colorResource(id = R.color.dark_blue_gray_text),
|
|
color = colorResource(id = R.color.dark_blue_gray_text),
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -246,26 +225,6 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
Log.d("test_return_ping","C[1]=> " + server.server_name + server.ping)
|
|
Log.d("test_return_ping","C[1]=> " + server.server_name + server.ping)
|
|
-
|
|
|
|
-// Log.d("test_servers_count", "${server.server_name} ${server.countryServers?.size}")
|
|
|
|
- /* Country Location's Row -> 1 Location() */
|
|
|
|
-
|
|
|
|
-// var ping by remember { mutableIntStateOf(0) }
|
|
|
|
-// Ping.onAddress(server.ip as String).setTimeOutMillis(1000).doPing(
|
|
|
|
-// object : Ping.PingListener{
|
|
|
|
-// override fun onResult(pingResult: PingResult?) {
|
|
|
|
-// android.os.Handler(Looper.getMainLooper()).post {
|
|
|
|
-// val ping = pingResult?.timeTaken?.toInt()!!
|
|
|
|
-// server.ping = ping
|
|
|
|
-// Log.d("test_ping", "ping = $ping")
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// override fun onError(e: Exception?) {}
|
|
|
|
-// override fun onFinished(pingStats: PingStats?) {}
|
|
|
|
-// }
|
|
|
|
-// )
|
|
|
|
-
|
|
|
|
Row(
|
|
Row(
|
|
verticalAlignment = Alignment.Top,
|
|
verticalAlignment = Alignment.Top,
|
|
horizontalArrangement = Arrangement.Start,
|
|
horizontalArrangement = Arrangement.Start,
|
|
@@ -311,7 +270,7 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
text = "${server.ping} ms",
|
|
text = "${server.ping} ms",
|
|
style = MaterialTheme.typography.displayMedium,
|
|
style = MaterialTheme.typography.displayMedium,
|
|
color = colorResource(id = R.color.blue_text),
|
|
color = colorResource(id = R.color.blue_text),
|
|
- modifier = Modifier
|
|
|
|
|
|
+ modifier = Modifier
|
|
.padding(end = 30.dp, bottom = 18.dp)
|
|
.padding(end = 30.dp, bottom = 18.dp)
|
|
.align(Alignment.CenterVertically)
|
|
.align(Alignment.CenterVertically)
|
|
)
|
|
)
|
|
@@ -350,20 +309,36 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
|
|
)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// Log.d("test_servers_count", "${server.server_name} ${server.countryServers?.size}")
|
|
|
|
+ /* Country Location's Row -> 1 Location() */
|
|
|
|
+
|
|
|
|
+// var ping by remember { mutableIntStateOf(0) }
|
|
|
|
+// Ping.onAddress(server.ip as String).setTimeOutMillis(1000).doPing(
|
|
|
|
+// object : Ping.PingListener{
|
|
|
|
+// override fun onResult(pingResult: PingResult?) {
|
|
|
|
+// android.os.Handler(Looper.getMainLooper()).post {
|
|
|
|
+// val ping = pingResult?.timeTaken?.toInt()!!
|
|
|
|
+// server.ping = ping
|
|
|
|
+// Log.d("test_ping", "ping = $ping")
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// override fun onError(e: Exception?) {}
|
|
|
|
+// override fun onFinished(pingStats: PingStats?) {}
|
|
|
|
+// }
|
|
|
|
+// )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
Surface(
|
|
Surface(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
.padding(start = 0.dp, end = 0.dp)
|
|
.padding(start = 0.dp, end = 0.dp)
|
|
.height(1.dp)
|
|
.height(1.dp)
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
.alpha(0.6F)
|
|
.alpha(0.6F)
|
|
- .align(Alignment.BottomCenter)
|
|
|
|
- ,
|
|
|
|
|
|
+ .align(Alignment.BottomCenter),
|
|
color = colorResource(id = R.color.gray_icon)
|
|
color = colorResource(id = R.color.gray_icon)
|
|
) {}
|
|
) {}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|