|
@@ -4,6 +4,7 @@ import android.content.Context
|
|
|
import android.content.res.Configuration
|
|
|
import android.util.Log
|
|
|
import android.widget.Toast
|
|
|
+import androidx.activity.ComponentActivity
|
|
|
import androidx.compose.foundation.BorderStroke
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
import androidx.compose.foundation.Image
|
|
@@ -76,12 +77,12 @@ import androidx.compose.runtime.livedata.observeAsState
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
import androidx.compose.runtime.rememberCoroutineScope
|
|
|
import androidx.compose.runtime.rememberUpdatedState
|
|
|
+import androidx.compose.ui.draw.alpha
|
|
|
import androidx.compose.ui.draw.clip
|
|
|
import androidx.compose.ui.graphics.painter.Painter
|
|
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalLifecycleOwner
|
|
|
-import androidx.core.app.ComponentActivity
|
|
|
import androidx.lifecycle.Lifecycle
|
|
|
import androidx.lifecycle.LifecycleEventObserver
|
|
|
import androidx.lifecycle.LifecycleOwner
|
|
@@ -95,6 +96,8 @@ import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
import com.vpn.fastestvpnservice.interfaces.ServerCallbacks
|
|
|
import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
|
|
|
import com.vpn.fastestvpnservice.ui.theme.FastestVPNTheme
|
|
|
+import com.vpn.fastestvpnservice.ui.theme.customTypography
|
|
|
+import com.vpn.fastestvpnservice.ui.theme.customTypography2
|
|
|
import com.vpn.fastestvpnservice.utils.Utils
|
|
|
import com.vpn.fastestvpnservice.utils.WireGuardConnection
|
|
|
import com.vpn.fastestvpnservice.viewmodels.HomeViewModel
|
|
@@ -326,7 +329,8 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
AddText(
|
|
|
text = "$ipInfo",
|
|
|
size = 18.sp,
|
|
|
- color = MaterialTheme.colorScheme.primary
|
|
|
+ color = MaterialTheme.colorScheme.primary,
|
|
|
+ style = MaterialTheme.typography.customTypography.headlineLarge
|
|
|
)
|
|
|
Row(
|
|
|
) {
|
|
@@ -347,9 +351,9 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
)
|
|
|
}
|
|
|
AddText(
|
|
|
- text = "${serverObj?.server_name}, ${serverObj?.country}",
|
|
|
+ text = "${serverObj?.server_name ?: ""}, ${serverObj?.country ?: ""}",
|
|
|
size = 16.sp,
|
|
|
- color = MaterialTheme.colorScheme.primary
|
|
|
+ color = MaterialTheme.colorScheme.primary,
|
|
|
)
|
|
|
} else {
|
|
|
val image = Utils.getDrawable(context, serverDis?.countryCode)
|
|
@@ -369,7 +373,7 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
)
|
|
|
}
|
|
|
AddText(
|
|
|
- text = "${serverDis?.city}, ${serverDis?.country}",
|
|
|
+ text = "${serverDis?.city ?: ""}, ${serverDis?.country ?: ""}",
|
|
|
size = 16.sp,
|
|
|
color = MaterialTheme.colorScheme.primary
|
|
|
)
|
|
@@ -379,13 +383,15 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
AddText(
|
|
|
text = "Connected",
|
|
|
size = 18.sp,
|
|
|
- color = colorResource(id = R.color.light_blue_2)
|
|
|
+ color = colorResource(id = R.color.light_blue_2),
|
|
|
+ style = MaterialTheme.typography.customTypography.displaySmall
|
|
|
)
|
|
|
} else {
|
|
|
AddText(
|
|
|
text = "Disconnected",
|
|
|
size = 18.sp,
|
|
|
- color = colorResource(id = R.color.maroon_text)
|
|
|
+ color = colorResource(id = R.color.maroon_text),
|
|
|
+ style = MaterialTheme.typography.customTypography.displaySmall
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -447,10 +453,8 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
)
|
|
|
Text(
|
|
|
text = "Download",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.text_color_dark_gray),
|
|
|
- fontSize = 14.sp
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography.displayMedium,
|
|
|
+ modifier = Modifier.alpha(0.6F)
|
|
|
)
|
|
|
Row(
|
|
|
horizontalArrangement = Arrangement.SpaceAround,
|
|
@@ -458,19 +462,12 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
) {
|
|
|
Text(
|
|
|
text = "30.68",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.black),
|
|
|
- fontSize = 18.sp,
|
|
|
- textAlign = TextAlign.Right
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography.displayLarge
|
|
|
)
|
|
|
Text(
|
|
|
text = " MB/S",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.text_color_dark_gray),
|
|
|
- fontSize = 12.sp,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography2.labelSmall,
|
|
|
+ modifier = Modifier.alpha(0.5F)
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -497,10 +494,8 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
)
|
|
|
Text(
|
|
|
text = "Upload",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.text_color_dark_gray),
|
|
|
- fontSize = 14.sp
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography.displayMedium,
|
|
|
+ modifier = Modifier.alpha(0.6F)
|
|
|
)
|
|
|
Row(
|
|
|
horizontalArrangement = Arrangement.SpaceAround,
|
|
@@ -508,19 +503,13 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
) {
|
|
|
Text(
|
|
|
text = "12.11",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.black),
|
|
|
- fontSize = 18.sp,
|
|
|
- textAlign = TextAlign.Right
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography.displayLarge
|
|
|
+
|
|
|
)
|
|
|
Text(
|
|
|
text = " MB/S",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.text_color_dark_gray),
|
|
|
- fontSize = 12.sp,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.customTypography2.labelSmall,
|
|
|
+ modifier = Modifier.alpha(0.5F)
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -569,9 +558,7 @@ fun Home(navHostController: NavHostController, activity: ComponentActivity) {
|
|
|
) {
|
|
|
Text(
|
|
|
text = "Smart Connect",
|
|
|
- fontSize = 14.sp,
|
|
|
- fontWeight = FontWeight.Medium,
|
|
|
- fontStyle = FontStyle.Normal,
|
|
|
+ style = MaterialTheme.typography.customTypography.labelLarge,
|
|
|
modifier = Modifier.background(Color.Transparent)
|
|
|
)
|
|
|
}
|
|
@@ -640,18 +627,19 @@ fun OnLifecycleEvent(onEvent: (
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-fun ColumnScope.ColumnText(text: String, color: Color, size: TextUnit) {
|
|
|
+fun ColumnScope.ColumnText(
|
|
|
+ text: String,
|
|
|
+ color: Color,
|
|
|
+ size: TextUnit,
|
|
|
+ style: TextStyle
|
|
|
+) {
|
|
|
Surface(
|
|
|
modifier = Modifier.padding(start = 0.dp),
|
|
|
color = Color.Transparent
|
|
|
) {
|
|
|
Text(text = text,
|
|
|
- style = TextStyle(
|
|
|
- color = color,
|
|
|
- fontSize = size,
|
|
|
- fontStyle = FontStyle.Normal,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- ),
|
|
|
+ style = style,
|
|
|
+ color = color,
|
|
|
maxLines = 1,
|
|
|
modifier = Modifier
|
|
|
.padding(start = 0.dp, end = 0.dp)
|
|
@@ -691,12 +679,14 @@ fun BoxScope.AddRowSmart(navHostController: NavHostController) {
|
|
|
ColumnText(
|
|
|
text = "Fastest Location",
|
|
|
color = colorResource(id = R.color.blue_text),
|
|
|
- size = 12.sp
|
|
|
+ size = 12.sp,
|
|
|
+ style = MaterialTheme.typography.customTypography.headlineSmall
|
|
|
)
|
|
|
ColumnText(
|
|
|
text = "United Arab Emirates",
|
|
|
color = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
- size = 16.sp
|
|
|
+ size = 16.sp,
|
|
|
+ style = MaterialTheme.typography.labelMedium
|
|
|
)
|
|
|
}
|
|
|
Spacer(modifier = Modifier.weight(1F))
|
|
@@ -706,11 +696,7 @@ fun BoxScope.AddRowSmart(navHostController: NavHostController) {
|
|
|
) {
|
|
|
ClickableText(
|
|
|
text = AnnotatedString("Change"),
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.light_blue_2),
|
|
|
- fontSize = 14.sp,
|
|
|
- textAlign = TextAlign.Right
|
|
|
- ),
|
|
|
+ style = MaterialTheme.typography.customTypography.headlineMedium,
|
|
|
onClick = {
|
|
|
navHostController.navigate(
|
|
|
Screen.ServerList.route
|
|
@@ -765,12 +751,8 @@ fun BoxScope.AddRowSelectServer(navHostController: NavHostController) {
|
|
|
color = Color.Transparent
|
|
|
) {
|
|
|
Text(text = "See All Locations",
|
|
|
- style = TextStyle(
|
|
|
- color = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
- fontSize = 16.sp,
|
|
|
- fontStyle = FontStyle.Normal,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- ),
|
|
|
+ style = MaterialTheme.typography.labelMedium,
|
|
|
+ color = colorResource(id = R.color.dark_blue_gray_text),
|
|
|
maxLines = 2,
|
|
|
modifier = Modifier
|
|
|
.padding(start = 12.dp, end = 0.dp)
|
|
@@ -797,16 +779,16 @@ fun BoxScope.AddRowSelectServer(navHostController: NavHostController) {
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-fun ColumnScope.AddText(text: String, size: TextUnit, color: Color) {
|
|
|
+fun ColumnScope.AddText(
|
|
|
+ text: String,
|
|
|
+ size: TextUnit,
|
|
|
+ color: Color,
|
|
|
+ style: TextStyle
|
|
|
+) {
|
|
|
Text(
|
|
|
text = text,
|
|
|
- style = TextStyle(
|
|
|
- fontSize = size,
|
|
|
- color = color,
|
|
|
- textAlign = TextAlign.Center,
|
|
|
- fontStyle = FontStyle.Normal,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- )
|
|
|
+ style = style,
|
|
|
+ color = color
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -814,13 +796,8 @@ fun ColumnScope.AddText(text: String, size: TextUnit, color: Color) {
|
|
|
fun RowScope.AddText(text: String, size: TextUnit, color: Color) {
|
|
|
Text(
|
|
|
text = text,
|
|
|
- style = TextStyle(
|
|
|
- fontSize = size,
|
|
|
- color = color,
|
|
|
- textAlign = TextAlign.Center,
|
|
|
- fontStyle = FontStyle.Normal,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- )
|
|
|
+ style = MaterialTheme.typography.labelMedium,
|
|
|
+ color = color
|
|
|
)
|
|
|
}
|
|
|
|