Browse Source

Set UI of home screen on TV - 2nd Box, layouts, and also of Bottom Nav Bar as prescribed

Khubaib 10 tháng trước cách đây
mục cha
commit
fd6e6c69d2

+ 7 - 6
app/src/main/java/com/vpn/fastestvpnservice/navigation/CustomBottomBarTV.kt

@@ -191,11 +191,12 @@ fun BottomBarNavTV(
             .background(colorResource(id = R.color.background_color_gray)),
         contentAlignment = Alignment.Center
     ) {
+        val iconSize = 45.dp
         Row(
             modifier = Modifier
                 .height(55.dp)
-                .fillMaxWidth(fraction = 0.5f)
-                .padding(horizontal = 20.dp)
+                .fillMaxWidth(fraction = 0.4f)
+                .padding(horizontal = 0.dp)
                 .background(colorResource(id = R.color.background_color_gray)),
             horizontalArrangement = Arrangement.SpaceBetween,
             verticalAlignment = Alignment.CenterVertically
@@ -229,7 +230,7 @@ fun BottomBarNavTV(
                     contentDescription = "Navigation Icon",
                     tint = color,
                     modifier = Modifier
-                        .size(55.dp, 55.dp)
+                        .size(iconSize)
                         .padding(top = topPadding, bottom = 4.dp)
                         .alpha(alpha)
                 )
@@ -262,7 +263,7 @@ fun BottomBarNavTV(
                     contentDescription = "Navigation Icon",
                     tint = color,
                     modifier = Modifier
-                        .size(55.dp, 55.dp)
+                        .size(iconSize)
                         .padding(top = topPadding, bottom = 4.dp)
                         .alpha(alpha)
                 )
@@ -296,7 +297,7 @@ fun BottomBarNavTV(
                     contentDescription = "Navigation Icon",
                     tint = color,
                     modifier = Modifier
-                        .size(55.dp, 55.dp)
+                        .size(iconSize)
                         .padding(top = topPadding, bottom = 4.dp)
                         .alpha(alpha)
                 )
@@ -329,7 +330,7 @@ fun BottomBarNavTV(
                     contentDescription = "Navigation Icon",
                     tint = color,
                     modifier = Modifier
-                        .size(55.dp, 55.dp)
+                        .size(iconSize)
                         .padding(top = topPadding, bottom = 4.dp)
                         .alpha(alpha)
                 )

+ 19 - 22
app/src/main/java/com/vpn/fastestvpnservice/screensTV/HomeScreenTV.kt

@@ -337,7 +337,7 @@ fun HomeTV(navHostController: NavHostController) {
         // 1st box
         ConstraintLayout(modifier = Modifier
             .fillMaxSize()
-            .weight(0.65f)
+            .weight(0.6f)
             .background(Color.Transparent)
         )
         {
@@ -381,11 +381,11 @@ fun HomeTV(navHostController: NavHostController) {
                     modifier = Modifier
                         .fillMaxWidth()
                         .fillMaxHeight()
-                        .padding(bottom = 25.dp)
+                        .padding(bottom = 85.dp)
 //                            .offset(y = -(118).dp)
                         .background(Color.Transparent),
                     horizontalAlignment = Alignment.CenterHorizontally,
-                    verticalArrangement = Arrangement.Center
+                    verticalArrangement = Arrangement.Bottom
                 ) {
                     val serverObj = basePreferenceHelper.getConnectedServer()
                     val serverDis = basePreferenceHelper.getIpinfo()
@@ -634,20 +634,20 @@ fun HomeTV(navHostController: NavHostController) {
             modifier = Modifier
                 .background(colorResource(id = R.color.background_color_gray))
                 .fillMaxSize()
-                .weight(0.35f)
+                .weight(0.4f)
 //                .background(Color.Transparent),
         ) {
             Column(
                 modifier = Modifier.fillMaxSize(),
-                verticalArrangement = Arrangement.Top
+                verticalArrangement = Arrangement.Center
             ) {
 
                 Box(
                     modifier = Modifier
-                        .fillMaxWidth(fraction = if (isTablet()) 0.5f else 1f)
-                        .padding(horizontal = 20.dp)
+                        .fillMaxWidth(fraction = 0.4f)
+                        .padding(horizontal = 0.dp)
                         .padding(vertical = 2.dp)
-                        .height(100.dp)
+                        .height(90.dp)
                         .border(
                             border = BorderStroke(2.dp, colorResource(id = R.color.white)),
                             shape = RoundedCornerShape(28.dp)
@@ -729,7 +729,7 @@ fun HomeTV(navHostController: NavHostController) {
 //                            }
                         },
                         modifier = Modifier
-                            .padding(start = 14.dp, end = 14.dp, bottom = 8.dp, top = 16.dp)
+                            .padding(start = 14.dp, end = 14.dp, bottom = 6.dp, top = 12.dp)
                             .align(Alignment.BottomCenter)
                             .background(colorResource(id = R.color.transparent))
                             .onFocusChanged {
@@ -742,7 +742,7 @@ fun HomeTV(navHostController: NavHostController) {
 //                                ).show()
 //                            }
                             .fillMaxWidth()
-                            .height(40.dp),
+                            .height(35.dp),
                         shape = RoundedCornerShape(16.dp),
                         colors = ButtonDefaults.buttonColors(
                             contentColor = colorResource(id = R.color.white),
@@ -752,7 +752,7 @@ fun HomeTV(navHostController: NavHostController) {
                         Text(
                             text = "Smart Connect",
                             style = MaterialTheme.typography.customTypography.labelLarge.copy(
-                                fontSize = if (isTablet()) 21.sp else 18.sp
+                                fontSize = 16.sp, lineHeight = 0.sp
                             ),
                             modifier = Modifier.background(Color.Transparent)
                         )
@@ -771,10 +771,10 @@ fun HomeTV(navHostController: NavHostController) {
                 else colorResource(id = R.color.white)
                 Box(
                     modifier = Modifier
-                        .fillMaxWidth(fraction = if (isTablet()) 0.5f else 1f)
-                        .padding(horizontal = 20.dp, vertical = 2.dp)
+                        .fillMaxWidth(fraction = 0.4f)
+                        .padding(horizontal = 0.dp, vertical = 2.dp)
                         .padding(top = 0.dp)
-                        .height(55.dp)
+                        .height(50.dp)
                         .onKeyEvent {
                             if (it.type == KeyEventType.KeyDown && it.key == Key.DirectionDown) {
 //                                    Toast
@@ -792,7 +792,6 @@ fun HomeTV(navHostController: NavHostController) {
                             isLayoutFocused = it.isFocused
                         }
                         .focusable()
-
                         .clickable(
                             indication = null,
                             interactionSource = remember { MutableInteractionSource() }
@@ -822,7 +821,6 @@ fun HomeTV(navHostController: NavHostController) {
         }
     }
 }
-
 @Composable
 fun BoxScope.AddRowSmartTV(
     navHostController: NavHostController,
@@ -884,7 +882,7 @@ fun BoxScope.AddRowSmartTV(
                     tint = Color.Unspecified,
                     modifier = Modifier
                         .padding(start = 0.dp)
-                        .size(40.dp)
+                        .size(30.dp)
                         .weight(1f)
                         .clip(CircleShape)
                         .border(1.dp, colorResource(id = R.color.gray_opac_04), CircleShape)
@@ -906,7 +904,7 @@ fun BoxScope.AddRowSmartTV(
                 color = colorResource(id = R.color.blue_text),
                 size = 12.sp,
                 style = MaterialTheme.typography.customTypography.headlineSmall.copy(
-                    fontSize = if (isTablet()) 16.sp else 12.sp
+                    fontSize = 16.sp
                 )
             )
             ColumnText(
@@ -915,7 +913,7 @@ fun BoxScope.AddRowSmartTV(
                 color = colorResource(id = R.color.dark_blue_gray_text),
                 size = 16.sp,
                 style = MaterialTheme.typography.labelMedium.copy(
-                    fontSize = if (isTablet()) 20.sp else 16.sp
+                    fontSize = 16.sp
                 )
             )
         }
@@ -956,13 +954,12 @@ fun BoxScope.AddRowSmartTV(
                             ScreenTV.ServerListTV.route
                         )
                     }
-                    .focusable()
-                ,
+                    .focusable(),
                 text = AnnotatedString("Change"),
                 style = MaterialTheme.typography.customTypography.headlineMedium.copy(
 //                    MaterialTheme.colorScheme.surfaceContainerLow,
                     color = color,
-                    fontSize = if (isTablet()) 20.sp else 14.sp
+                    fontSize = 18.sp
                 ),
                 onClick = {},
             )