Browse Source

Worked on dark/light mode on Help, settings and account screens on TV

Khubaib 9 months ago
parent
commit
1e858efc0c

+ 15 - 12
app/src/main/java/com/vpn/fastestvpnservice/screensTV/AccountScreenTV.kt

@@ -119,7 +119,7 @@ fun AccountTV(navHostController: NavHostController,
         LocalOverscrollConfiguration provides null
     ) {
         Box(modifier = Modifier
-            .background(colorResource(id = R.color.background_color_gray))
+            .background(MaterialTheme.colorScheme.background)
             .fillMaxSize()
             .padding(top = 0.dp)
             .verticalScroll(rememberScrollState())
@@ -149,7 +149,7 @@ fun AccountTV(navHostController: NavHostController,
                 AddTextAccountTV(
                     text = "Account",
                     size = 28.sp,
-                    color = MaterialTheme.colorScheme.inversePrimary
+                    color = MaterialTheme.colorScheme.primary
                 )
 //                Spacer(modifier = Modifier.height(15.dp))
 //                AddRowAccountTV("Email: ", basePreferenceHelper.getUser()?.userinfo?.email ?: "")
@@ -477,8 +477,11 @@ fun ColumnScope.AddRowAccountIconTV(
         modifier = Modifier
             .fillMaxWidth()
             .padding(top = 5.dp)
-            .background(if (isRowFocused) Color.LightGray else Color.White,
-                shape = RoundedCornerShape(4.dp))
+            .background(
+                if (isRowFocused) colorResource(id = R.color.grey_password_field)
+                else MaterialTheme.colorScheme.onBackground,
+                shape = RoundedCornerShape(4.dp)
+            )
             .height(61.dp)
             .onKeyEvent {
                 if (isLastRow) {
@@ -491,19 +494,19 @@ fun ColumnScope.AddRowAccountIconTV(
 //                        customNavigation(navHostController, BottomBarScreen.Help)
                         isFourthItemPressed.value = true
                         true
-                    }
-                    else if (it.type == KeyEventType.KeyUp && it.key == Key.DirectionUp) {
+                    } else if (it.type == KeyEventType.KeyUp && it.key == Key.DirectionUp) {
 //                        Toast
 //                            .makeText(
 //                                context, "KeyUp & DirectionUp Email", Toast.LENGTH_SHORT
 //                            )
 //                            .show()
                         false
-                    }
-                    else {
+                    } else {
                         false
                     }
-                } else { false }
+                } else {
+                    false
+                }
             }
             .focusRequester(focusRequester1)
             .onFocusChanged {
@@ -531,7 +534,7 @@ fun ColumnScope.AddRowAccountIconTV(
                     .padding(start = 0.dp)
                     .size(24.dp)
                     .weight(1f),
-                colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.inversePrimary)
+                colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary)
             )
         }
         Surface(
@@ -539,7 +542,7 @@ fun ColumnScope.AddRowAccountIconTV(
             color = Color.Transparent
         ) {
             Text(text = text,
-                color = MaterialTheme.colorScheme.inversePrimary,
+                color = MaterialTheme.colorScheme.primary,
                 style = MaterialTheme.typography.titleSmall,
                 maxLines = 2,
                 modifier = Modifier
@@ -561,7 +564,7 @@ fun ColumnScope.AddRowAccountIconTV(
                     .padding(start = 0.dp, end = 3.dp)
                     .size(10.dp, 18.dp)
                     .weight(1f),
-                colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.inversePrimary)
+                colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary)
             )
         }
 

+ 7 - 7
app/src/main/java/com/vpn/fastestvpnservice/screensTV/HelpScreenTV.kt

@@ -94,7 +94,7 @@ fun HelpTV(navHostController: NavHostController) {
     ) {
         Box(
             modifier = Modifier
-                .background(colorResource(id = R.color.background_color_gray))
+                .background(MaterialTheme.colorScheme.background)
                 .fillMaxSize()
                 .padding(vertical = 0.dp)
                 .verticalScroll(rememberScrollState()),
@@ -124,7 +124,7 @@ fun HelpTV(navHostController: NavHostController) {
                 AddTextHelpTV(
                     text = "Help",
                     size = 28.sp,
-                    color = MaterialTheme.colorScheme.inversePrimary
+                    color = MaterialTheme.colorScheme.primary
                 )
                 Spacer(modifier = Modifier.height(22.dp))
                 AddRowTV(
@@ -215,7 +215,7 @@ fun ColumnScope.AddRowTV(
             .fillMaxWidth()
             .padding(top = 5.dp)
             .clip(RoundedCornerShape(4.dp))
-            .background(if (isRowFocused) Color.LightGray else Color.White)
+            .background(if (isRowFocused) Color.LightGray else MaterialTheme.colorScheme.onBackground)
             .height(61.dp)
             .onKeyEvent {
                 if (isLastRow) {
@@ -268,7 +268,7 @@ fun ColumnScope.AddRowTV(
                         .size(24.dp)
                         .weight(1f),
                     colorFilter = ColorFilter.tint(
-                        MaterialTheme.colorScheme.inversePrimary)
+                        MaterialTheme.colorScheme.primary)
                 )
             } else {
                 Image(
@@ -279,7 +279,7 @@ fun ColumnScope.AddRowTV(
                         .size(24.dp)
                         .weight(1f),
                     colorFilter = ColorFilter.tint(
-                        MaterialTheme.colorScheme.inversePrimary)
+                        MaterialTheme.colorScheme.primary)
                 )
             }
         }
@@ -289,7 +289,7 @@ fun ColumnScope.AddRowTV(
             color = Color.Transparent
         ) {
             Text(text = text,
-                color = MaterialTheme.colorScheme.inversePrimary,
+                color = MaterialTheme.colorScheme.primary,
                 style = MaterialTheme.typography.titleSmall,
                 maxLines = 2,
                 modifier = Modifier
@@ -316,7 +316,7 @@ fun ColumnScope.AddRowTV(
                     .weight(1f)
                     .alpha(1F),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary)
+                    MaterialTheme.colorScheme.primary)
             )
         }
 

+ 18 - 18
app/src/main/java/com/vpn/fastestvpnservice/screensTV/SettingsScreenTV.kt

@@ -157,7 +157,7 @@ fun SettingsTV(navHostController: NavHostController) {
         Box(
             modifier = Modifier
 //            .background(MaterialTheme.colorScheme.background)
-                .background(colorResource(id = R.color.background_color_gray))
+                .background(MaterialTheme.colorScheme.background)
                 .fillMaxSize()
                 .padding(vertical = 0.dp),
         ) {
@@ -189,7 +189,7 @@ fun SettingsTV(navHostController: NavHostController) {
                 AddTextSettingsTV(
                     text = "Settings",
                     size = 28.sp,
-                    color = MaterialTheme.colorScheme.inversePrimary,
+                    color = MaterialTheme.colorScheme.primary,
                     style = MaterialTheme.typography.headlineLarge
                 )
                 Spacer(modifier = Modifier.height(22.dp))
@@ -272,7 +272,7 @@ fun ColumnScope.AddRowSettingsTV(
             .fillMaxWidth()
             .padding(top = 5.dp, end = 27.dp)
             .clip(RoundedCornerShape(4.dp))
-            .background(if (isRowFocused) Color.LightGray else Color.White)
+            .background(if (isRowFocused) Color.LightGray else MaterialTheme.colorScheme.onBackground)
             .onKeyEvent {
                 if (isLastRow) {
                     if (it.type == KeyEventType.KeyDown && it.key == Key.DirectionDown) {
@@ -314,7 +314,7 @@ fun ColumnScope.AddRowSettingsTV(
                     .size(24.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary)            )
+                    MaterialTheme.colorScheme.primary)            )
         }
 
         Surface(
@@ -323,7 +323,7 @@ fun ColumnScope.AddRowSettingsTV(
         ) {
             Text(text = text,
                 style = MaterialTheme.typography.titleSmall,
-                color = MaterialTheme.colorScheme.inversePrimary,
+                color = MaterialTheme.colorScheme.primary,
                 maxLines = 1,
                 modifier = Modifier
                     .padding(start = 18.dp, end = 0.dp)
@@ -347,7 +347,7 @@ fun ColumnScope.AddRowSettingsTV(
                     .size(10.dp, 18.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary
+                    MaterialTheme.colorScheme.primary
                 )
             )
         }
@@ -389,7 +389,7 @@ fun ColumnScope.AddRowSwitchTV(icon: Int, text: String, focusRequester3: FocusRe
             .fillMaxWidth()
             .padding(top = 5.dp, end = 27.dp)
             .clip(RoundedCornerShape(4.dp))
-            .background(if (isRowFocused) Color.LightGray else Color.White)
+            .background(if (isRowFocused) Color.LightGray else MaterialTheme.colorScheme.onBackground)
 //            .focusRequester(focusRequester3)
             .onFocusChanged {
                 isRowFocused = it.isFocused
@@ -422,7 +422,7 @@ fun ColumnScope.AddRowSwitchTV(icon: Int, text: String, focusRequester3: FocusRe
                     .size(24.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary)            )
+                    MaterialTheme.colorScheme.primary)            )
         }
 
         Surface(
@@ -431,7 +431,7 @@ fun ColumnScope.AddRowSwitchTV(icon: Int, text: String, focusRequester3: FocusRe
         ) {
             Text(text = text,
                 style = MaterialTheme.typography.titleSmall,
-                color = MaterialTheme.colorScheme.inversePrimary,
+                color = MaterialTheme.colorScheme.primary,
                 maxLines = 1,
                 modifier = Modifier
                     .padding(start = 18.dp, end = 0.dp)
@@ -514,7 +514,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
             .fillMaxWidth()
             .padding(top = 5.dp, end = 27.dp)
             .clip(RoundedCornerShape(4.dp))
-            .background(if (isFirstRowFocused) Color.LightGray else Color.White)
+            .background(if (isFirstRowFocused) Color.LightGray else MaterialTheme.colorScheme.onBackground)
             .height(61.dp)
 //            .onKeyEvent {
 //                when (it.key) {
@@ -573,7 +573,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
                     .size(24.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary)
+                    MaterialTheme.colorScheme.primary)
             )
         }
 
@@ -588,7 +588,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
                 verticalArrangement = Arrangement.Center
             ) {
                 Text(text = text,
-                    color = MaterialTheme.colorScheme.inversePrimary,
+                    color = MaterialTheme.colorScheme.primary,
                     style = MaterialTheme.typography.titleSmall,
                     maxLines = 1,
                     modifier = Modifier
@@ -600,7 +600,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
                     style = MaterialTheme.typography.headlineSmall.copy(
                         fontSize = if (isTablet()) 14.sp else 12.sp
                     ),
-                    color = MaterialTheme.colorScheme.inversePrimary,
+                    color = MaterialTheme.colorScheme.primary,
                     maxLines = 1,
                     modifier = Modifier
                         .padding(start = 18.dp, end = 0.dp)
@@ -626,7 +626,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
                     .size(10.dp, 18.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary
+                    MaterialTheme.colorScheme.primary
                 )
             )
         }
@@ -787,7 +787,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
             .fillMaxWidth()
             .padding(top = 5.dp, end = 27.dp)
             .clip(RoundedCornerShape(4.dp))
-            .background(if (isRowFocused) Color.LightGray else Color.White)
+            .background(if (isRowFocused) Color.LightGray else MaterialTheme.colorScheme.onBackground)
 //            .onKeyEvent {
 //                when (it.key) {
 //                    Key.DirectionLeft -> {
@@ -839,7 +839,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
                     .size(24.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary)
+                    MaterialTheme.colorScheme.primary)
             )
         }
 
@@ -849,7 +849,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
         ) {
             Text(text = text,
                 style = MaterialTheme.typography.titleSmall,
-                color = MaterialTheme.colorScheme.inversePrimary,
+                color = MaterialTheme.colorScheme.primary,
                 maxLines = 1,
                 modifier = Modifier
                     .padding(start = 18.dp, end = 0.dp)
@@ -871,7 +871,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
                     .size(10.dp, 18.dp)
                     .weight(1f),
                 colorFilter = ColorFilter.tint(
-                    MaterialTheme.colorScheme.inversePrimary
+                    MaterialTheme.colorScheme.primary
                 )
             )
         }