Bläddra i källkod

Login screen set string resource, Adjust UI of server list layout on Android & TV

Khubaib 7 månader sedan
förälder
incheckning
2cf7e008a3

+ 11 - 8
app/src/main/java/com/vpn/fastestvpnservice/screens/bottomNavBarScreens/HomeScreen.kt

@@ -78,6 +78,7 @@ import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.AnnotatedString
 import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.style.TextOverflow
 import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.TextUnit
 import androidx.compose.ui.unit.dp
@@ -1556,11 +1557,11 @@ fun BoxScope.AddRowSelectServer(navHostController: NavHostController, isTablet:
                 modifier = Modifier
                     .padding(start = 0.dp)
                     .size(40.dp)
-                    .weight(1f)
+//                    .weight(1f)
             )
         }
         Surface(
-            modifier = Modifier.padding(start = 0.dp),
+            modifier = Modifier.padding(start = 12.dp, end = 12.dp).weight(1f),
             color = Color.Transparent
         ) {
             Text(text = context.getString(R.string.see_all_locations),
@@ -1569,14 +1570,16 @@ fun BoxScope.AddRowSelectServer(navHostController: NavHostController, isTablet:
                 ),
                 color = MaterialTheme.colorScheme.primary,
                 maxLines = 2,
+                lineHeight = 20.sp,
+                overflow = TextOverflow.Ellipsis,
                 modifier = Modifier
-                    .padding(start = 12.dp, end = 0.dp)
-                    .weight(1f)
+                    .padding(start = 0.dp, end = 0.dp)
+//                    .weight(1f)
             )
         }
-        Spacer(modifier = Modifier.weight(1F))
+//        Spacer(modifier = Modifier.weight(1F))
         Surface(
-            modifier = Modifier.padding(start = 15.dp),
+            modifier = Modifier.padding(start = 0.dp),
             color = Color.Transparent
 
         ) {
@@ -1585,9 +1588,9 @@ fun BoxScope.AddRowSelectServer(navHostController: NavHostController, isTablet:
                 contentDescription = "Front_Arrow",
                 colorFilter = ColorFilter.tint(colorResource(id = R.color.gray_icon)),
                 modifier = Modifier
-                    .padding(start = 0.dp, end = 5.dp)
+                    .padding(start = 0.dp, end = 0.dp)
                     .size(10.dp, 18.dp)
-                    .weight(1f),
+//                    .weight(1f),
             )
         }
 

+ 15 - 34
app/src/main/java/com/vpn/fastestvpnservice/screensTV/HomeScreenTV.kt

@@ -5,7 +5,6 @@ import android.content.Context
 import android.os.Build
 import android.os.Handler
 import android.util.Log
-import android.widget.Toast
 import androidx.activity.ComponentActivity
 import androidx.compose.animation.animateColorAsState
 import androidx.compose.foundation.BorderStroke
@@ -23,7 +22,6 @@ import androidx.compose.foundation.layout.ColumnScope
 import androidx.compose.foundation.layout.Row
 import androidx.compose.foundation.layout.RowScope
 import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.aspectRatio
 import androidx.compose.foundation.layout.fillMaxHeight
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
@@ -31,7 +29,6 @@ import androidx.compose.foundation.layout.height
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
 import androidx.compose.foundation.layout.wrapContentHeight
-import androidx.compose.foundation.layout.wrapContentSize
 import androidx.compose.foundation.shape.CircleShape
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.foundation.text.ClickableText
@@ -83,6 +80,7 @@ import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.AnnotatedString
 import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.style.TextOverflow
 import androidx.compose.ui.unit.TextUnit
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
@@ -1661,76 +1659,59 @@ fun BoxScope.AddRowSmartTV(
 
 @Composable
 fun BoxScope.AddRowSelectServerTV(navHostController: NavHostController, isTablet: Boolean) {
-
     val context = LocalContext.current
     Row(
         modifier = Modifier
             .fillMaxWidth()
             .padding(horizontal = 15.dp)
-            .background(Color.Transparent)
-
-//            .pointerInput(Unit) {
-//                detectTapGestures {
-//                    toChangeServer.value = false
-//                    navHostController.navigate(
-//                        Screen.ServerList.route
-//                    )
-//                    Screen.ServerList.isTrue = true
-//                    Log.d("button_click_change", "Pressed")
-//                }
-//            }
-
-        ,
+            .background(Color.Transparent),
         horizontalArrangement = Arrangement.Start,
         verticalAlignment = Alignment.CenterVertically
     ) {
-
         Surface(
             modifier = Modifier.padding(start = 0.dp),
-            color = Color.Transparent
+            color = Color.Transparent,
         ) {
             Image(
                 painter = painterResource(id = R.drawable.worldmap3x),
                 contentDescription = "World",
                 modifier = Modifier
-                    .padding(start = 0.dp)
                     .size(30.dp)
-                    .weight(1f)
+//                    .weight(1f)
             )
         }
         Surface(
-            modifier = Modifier.padding(start = 0.dp),
+            modifier = Modifier.padding(start = 12.dp, end = 12.dp).weight(1F),
             color = Color.Transparent
         ) {
-            Text(text = context.getString(R.string.see_all_locations),
+            Text(
+                text = context.getString(R.string.see_all_locations),
                 style = MaterialTheme.typography.labelMedium.copy(
-                    fontSize = if (isTablet()) 20.sp else 16.sp
+                    fontSize = 16.sp
                 ),
                 color = MaterialTheme.colorScheme.primary,
+                lineHeight = 20.sp,
 //                color = colorResource(id = R.color.dark_blue_gray_text),
                 maxLines = 2,
+                overflow = TextOverflow.Ellipsis,
                 modifier = Modifier
-                    .padding(start = 12.dp, end = 0.dp)
-                    .weight(1f)
+//                    .weight(1f)
             )
         }
-        Spacer(modifier = Modifier.weight(1F))
+//        Spacer(modifier = Modifier.weight(1F))
         Surface(
-            modifier = Modifier.padding(start = 15.dp),
+            modifier = Modifier.padding(start = 0.dp, end = 0.dp),
             color = Color.Transparent
-
         ) {
             Image(
                 painter = painterResource(id = R.drawable.frontarrow3x),
                 contentDescription = "Front_Arrow",
-                colorFilter = ColorFilter.tint(colorResource(id = R.color.dark_blue_gray_text)),
+                colorFilter = ColorFilter.tint(colorResource(id = R.color.gray_icon)),
                 modifier = Modifier
-                    .padding(start = 0.dp, end = 5.dp)
                     .size(10.dp, 18.dp)
-                    .weight(1f)
+//                    .weight(1f)
             )
         }
-
     }
 }
 

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

@@ -158,7 +158,7 @@ fun LoginTV(navHostController: NavHostController) {
                     horizontalAlignment = Alignment.CenterHorizontally
                 ) {
                     TextMsgTV(
-                        text = "Welcome Back!",
+                        text = context.getString(R.string.welcome_back),
                         color = Color.White,
                         style = MaterialTheme.typography.displayLarge
                     )
@@ -191,7 +191,7 @@ fun LoginTV(navHostController: NavHostController) {
                         ,
                         shape = RoundedCornerShape(16.dp),
                         label = {
-                            Text(text = "Email",
+                            Text(text = context.getString(R.string.email),
                                 style = MaterialTheme.typography.customTypography.bodyLarge
                             )
                         },
@@ -266,7 +266,7 @@ fun LoginTV(navHostController: NavHostController) {
                         },
                         shape = RoundedCornerShape(16.dp),
                         label = {
-                            Text(text = "Password",
+                            Text(text = context.getString(R.string.password),
                                 style = MaterialTheme.typography.customTypography.bodyLarge
                             )
                         },
@@ -416,7 +416,7 @@ fun ColumnScope.LoginButtonTV(
                 modifier = Modifier
                     .background(Color.Transparent)
                     .align(Alignment.Center),
-                text = "Sign In",
+                text = context.getString(R.string.signin),
                 style = MaterialTheme.typography.titleMedium,
                 color = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
 //                color = MaterialTheme.colorScheme.primaryContainer