Browse Source

working on fonts...

Khubaib 1 year ago
parent
commit
3f3add1e3a

+ 20 - 2
app/src/main/java/com/vpn/fastestvpnservice/customItems/CountryItem.kt

@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
 import androidx.compose.foundation.lazy.LazyColumn
 import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.CircleShape
 import androidx.compose.material3.Icon
 import androidx.compose.material3.IconButton
 import androidx.compose.material3.MaterialTheme
@@ -38,8 +39,11 @@ import androidx.compose.runtime.setValue
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.draw.paint
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
@@ -123,7 +127,9 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
                                         navHostController.popBackStack()
                                     }
                             ) {
-                                val icon = Utils.getDrawable(context, server.iso)
+                                val icon = if (server.enable == 1) Utils.getDrawable(context, server.iso)
+                                else Utils.getDrawableGray(context, server.iso)
+
                                 Icon(
                                     painter = painterResource(id = icon),
                                     contentDescription = "Server Logo",
@@ -131,6 +137,11 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
                                     modifier = Modifier
                                         .padding(bottom = 16.dp)
                                         .size(24.dp)
+                                        .clip(CircleShape)
+                                        .paint(
+                                            painter = painterResource(id = icon),
+                                            contentScale = ContentScale.FillHeight
+                                        )
                                 )
                                 Text(text = server.country!!,
                                     style = TextStyle(
@@ -216,7 +227,9 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
                                 }
 
                         ) {
-                            val icon = Utils.getDrawable(context, server.iso)
+                            val icon = if (server.enable == 1) Utils.getDrawable(context, server.iso)
+                            else Utils.getDrawableGray(context, server.iso)
+
                             Icon(
                                 painter = painterResource(id = icon),
                                 contentDescription = "Server Logo",
@@ -224,6 +237,11 @@ fun CountryItem(server: Server, category: String, navHostController: NavHostCont
                                 modifier = Modifier
                                     .padding(bottom = 16.dp)
                                     .size(24.dp)
+                                    .clip(CircleShape)
+                                    .paint(
+                                        painter = painterResource(id = icon),
+                                        contentScale = ContentScale.FillHeight
+                                    )
                             )
                             val serverTitle = if (category.lowercase().toString() == "servers") server.country else server.server_name
                             Text(text = serverTitle!!,

+ 21 - 3
app/src/main/java/com/vpn/fastestvpnservice/customItems/ServerItem.kt

@@ -132,7 +132,9 @@ fun ServerItem(server: Server, navHostController: NavHostController) {
                     override fun onFinished(pingStats: PingStats?) {}
                 }
             )
-            val icon = Utils.getDrawable(context, server.iso)
+            val icon = if (server.enable == 1) Utils.getDrawable(context, server.iso)
+            else Utils.getDrawableGray(context, server.iso)
+
             Icon(
                 painter = painterResource(id = icon),
                 contentDescription = "Server Logo",
@@ -140,6 +142,11 @@ fun ServerItem(server: Server, navHostController: NavHostController) {
                 modifier = Modifier
                     .padding(bottom = 16.dp)
                     .size(24.dp)
+                    .clip(CircleShape)
+                    .paint(
+                        painter = painterResource(id = icon),
+                        contentScale = ContentScale.FillHeight
+                    )
             )
             Text(text = server.server_name!!,
                 style = TextStyle(
@@ -259,6 +266,9 @@ fun FavoriteServerItem(server: Server, navHostController: NavHostController) {
                     indication = null,
                     interactionSource = remember { MutableInteractionSource() }
                 ) {
+                    Toast.makeText(
+                        context, server.server_name, Toast.LENGTH_SHORT
+                    ).show()
                     basePreferenceHelper.setServerObject(server)
                     navHostController.popBackStack()
                 }
@@ -276,7 +286,8 @@ fun FavoriteServerItem(server: Server, navHostController: NavHostController) {
                     override fun onFinished(pingStats: PingStats?) {}
                 }
             )
-            val icon = Utils.getDrawable(context, server.iso)
+            val icon = if (server.enable == 1) Utils.getDrawable(context, server.iso)
+            else Utils.getDrawableGray(context, server.iso)
 
             Icon(
                 painter = painterResource(id = icon),
@@ -412,7 +423,9 @@ fun ServerSearchItem(server: Server, navHostController: NavHostController) {
                     override fun onFinished(pingStats: PingStats?) {}
                 }
             )
-            val icon = Utils.getDrawable(context, server.iso)
+            val icon = if (server.enable == 1) Utils.getDrawable(context, server.iso)
+            else Utils.getDrawableGray(context, server.iso)
+
             Icon(
                 painter = painterResource(id = icon),
                 contentDescription = "Server Logo",
@@ -420,6 +433,11 @@ fun ServerSearchItem(server: Server, navHostController: NavHostController) {
                 modifier = Modifier
                     .padding(bottom = 16.dp)
                     .size(24.dp)
+                    .clip(CircleShape)
+                    .paint(
+                        painter = painterResource(id = icon),
+                        contentScale = ContentScale.FillHeight
+                    )
             )
             Text(text = server.server_name!!,
                 style = TextStyle(

+ 4 - 2
app/src/main/java/com/vpn/fastestvpnservice/screens/StartedScreen.kt

@@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.width
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.material3.Button
 import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.MaterialTheme
 import androidx.compose.material3.Scaffold
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
@@ -32,6 +33,7 @@ import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.platform.LocalConfiguration
 import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
 import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.font.FontStyle
 import androidx.compose.ui.text.font.FontWeight
@@ -44,6 +46,7 @@ import androidx.navigation.NavHostController
 import androidx.navigation.compose.rememberNavController
 import com.vpn.fastestvpnservice.R
 import com.vpn.fastestvpnservice.sealedClass.Screen
+import com.vpn.fastestvpnservice.ui.theme.outfitFontFamily
 
 @Composable
 fun Started(navHostController: NavHostController) {
@@ -81,10 +84,9 @@ fun Started(navHostController: NavHostController) {
                 Text(
                     modifier = Modifier
                         .padding(bottom = 25.dp),
-                    fontSize = 30.sp,
-                    fontWeight = FontWeight.SemiBold,
                     text = "Secure. Fast. Stable.",
                     color = colorResource(id = R.color.white),
+                    style = MaterialTheme.typography.titleLarge,
                 )
                 Text(
                     modifier = Modifier

+ 99 - 16
app/src/main/java/com/vpn/fastestvpnservice/ui/theme/Type.kt

@@ -2,33 +2,116 @@ package com.vpn.fastestvpnservice.ui.theme
 
 import androidx.compose.material3.Typography
 import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.Font
 import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.unit.sp
+import com.vpn.fastestvpnservice.R
 
 // Set of Material typography styles to start with
+
+val outfitFontFamily = FontFamily(
+    Font(R.font.outfit_black, FontWeight.Black),
+    Font(R.font.outfit_bold, FontWeight.Bold),
+    Font(R.font.outfit_extrabold, FontWeight.ExtraBold),
+    Font(R.font.outfit_semibold, FontWeight.SemiBold),
+    Font(R.font.outfit_medium, FontWeight.Medium),
+    Font(R.font.outfit_regular, FontWeight.Normal),
+    Font(R.font.outfit_light, FontWeight.Light),
+    Font(R.font.outfit_extralight, FontWeight.ExtraLight),
+    Font(R.font.outfit_thin, FontWeight.Thin)
+)
+
 val Typography = Typography(
-    bodyLarge = TextStyle(
-        fontFamily = FontFamily.Default,
+
+    displaySmall = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 14.sp,
+    ),
+    displayMedium = TextStyle(
+        fontFamily = outfitFontFamily,
         fontWeight = FontWeight.Normal,
         fontSize = 16.sp,
-        lineHeight = 24.sp,
-        letterSpacing = 0.5.sp
-    )
-    /* Other default text styles to override
+        textAlign = TextAlign.Right,
+        lineHeight = 30.sp
+    ),
+    displayLarge = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Medium,
+        fontSize = 28.sp,
+    ),
+    headlineSmall = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 12.sp,
+    ),
+    headlineMedium = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 14.sp,
+        textAlign = TextAlign.Center,
+        letterSpacing = (-0.14).sp
+    ),
+    headlineLarge = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Medium,
+        fontSize = 28.sp,
+    ),
+    titleSmall = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Medium,
+        fontSize = 16.sp,
+    ),
+    titleMedium = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Medium,
+        fontSize = 18.sp,
+    ),
     titleLarge = TextStyle(
-        fontFamily = FontFamily.Default,
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.SemiBold,
+        fontSize = 30.sp,
+        lineHeight = 50.sp,
+        letterSpacing = 0.45.sp,
+        textAlign = TextAlign.Center
+    ),
+
+    bodySmall = TextStyle(
+        fontFamily = outfitFontFamily,
         fontWeight = FontWeight.Normal,
-        fontSize = 22.sp,
-        lineHeight = 28.sp,
-        letterSpacing = 0.sp
+        fontSize = 14.sp,
+        lineHeight = 30.sp,
     ),
-    labelSmall = TextStyle(
-        fontFamily = FontFamily.Default,
+    bodyMedium = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Medium,
+        fontSize = 18.sp,
+        textAlign = TextAlign.Center,
+    ),
+    bodyLarge = TextStyle(
+        fontFamily = outfitFontFamily,
         fontWeight = FontWeight.Medium,
-        fontSize = 11.sp,
-        lineHeight = 16.sp,
-        letterSpacing = 0.5.sp
+        fontSize = 14.sp,
+    ),
+    labelSmall = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 14.sp,
+        textAlign = TextAlign.Center,
+        lineHeight = 30.sp
+    ),
+    labelMedium = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 16.sp,
+        textAlign = TextAlign.Center
+    ),
+    labelLarge = TextStyle(
+        fontFamily = outfitFontFamily,
+        fontWeight = FontWeight.Normal,
+        fontSize = 18.sp,
+        textAlign = TextAlign.Center
     )
-    */
 )

BIN
app/src/main/res/font/outfit_black.ttf


BIN
app/src/main/res/font/outfit_bold.ttf


BIN
app/src/main/res/font/outfit_extrabold.ttf


BIN
app/src/main/res/font/outfit_extralight.ttf


BIN
app/src/main/res/font/outfit_light.ttf


BIN
app/src/main/res/font/outfit_medium.ttf


BIN
app/src/main/res/font/outfit_regular.ttf


BIN
app/src/main/res/font/outfit_semibold.ttf


BIN
app/src/main/res/font/outfit_thin.ttf