Browse Source

working on dark theme...

Khubaib 1 year ago
parent
commit
b4e78ea65b

+ 12 - 13
app/src/main/java/com/vpn/fastestvpnservice/customItems/SubscriptionPackageItem.kt

@@ -47,6 +47,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
 import androidx.navigation.compose.rememberNavController
 import com.vpn.fastestvpnservice.R
 import com.vpn.fastestvpnservice.beans.SubscriptionPackageList
+import com.vpn.fastestvpnservice.beans.isDarkTheme
 import com.vpn.fastestvpnservice.beans.subscriptionPackageList
 import com.vpn.fastestvpnservice.ui.theme.customTypography2
 import com.vpn.fastestvpnservice.viewmodels.SubscriptionViewModel
@@ -86,13 +87,13 @@ fun SubscriptionPackageItem(item: SubscriptionPackageList, position: Int,
                 border = BorderStroke(
                     2.dp,
                     if (item.isSelected.value) colorResource(id = R.color.blue_text)
-                    else Color.White
+                    else MaterialTheme.colorScheme.onBackground
                 ),
                 shape = RoundedCornerShape(24.dp)
             )
             .background(
                 shape = RoundedCornerShape(24.dp),
-                color = Color.White
+                color = MaterialTheme.colorScheme.onBackground
             )
             .pointerInput(Unit) {
                 detectTapGestures {
@@ -151,7 +152,7 @@ fun SubscriptionPackageItem(item: SubscriptionPackageList, position: Int,
             modifier = Modifier
                 .fillMaxSize()
                 .padding(20.dp)
-                .background(Color.White)
+                .background(MaterialTheme.colorScheme.onBackground)
         ) {
             Row(
                 verticalAlignment = Alignment.Top,
@@ -160,35 +161,33 @@ fun SubscriptionPackageItem(item: SubscriptionPackageList, position: Int,
                     .fillMaxWidth()
             ) {
                 Text(text = item.packageDuration,
-                    color = if (item.isSelected.value) colorResource(
-                        id = R.color.blue_text) else colorResource(
-                        id = R.color.dark_blue_gray_text),
+                    color = if (item.isSelected.value) MaterialTheme.colorScheme.primaryContainer
+                    else MaterialTheme.colorScheme.surfaceBright,
                     style = MaterialTheme.typography.titleMedium,
                     maxLines = 1,
                     modifier = Modifier
                         .padding(start = 0.dp, end = 0.dp)
-                        .alpha(if (item.isSelected.value) 1F else 0.6F)
+                        .alpha(if (!isDarkTheme.value) if (item.isSelected.value) 1F else 0.6F else 1F)
                 )
                 Text(text = item.price,
-                    color = if (item.isSelected.value) colorResource(
-                        id = R.color.light_blue_2) else colorResource(
-                        id = R.color.text_color_dark_gray),
+                    color = if (item.isSelected.value) MaterialTheme.colorScheme.surface
+                    else MaterialTheme.colorScheme.surfaceBright,
                     style = MaterialTheme.typography.customTypography2.labelLarge,
                     maxLines = 1,
                     modifier = Modifier
                         .padding(start = 0.dp, end = 0.dp)
-                        .alpha(if (item.isSelected.value) 1F else 0.6F)
+                        .alpha(if (!isDarkTheme.value) if (item.isSelected.value) 1F else 0.6F else 1F)
                 )
             }
             Text(text = item.planType,
-                color = colorResource(id = R.color.dark_blue_gray_text),
+                color = MaterialTheme.colorScheme.tertiaryContainer,
                 style = MaterialTheme.typography.bodyLarge,
                 maxLines = 1,
                 modifier = Modifier
                     .padding(top = 6.dp, end = 0.dp)
             )
             Text(text = item.desc,
-                color = colorResource(id = R.color.dark_blue_gray_text),
+                color = MaterialTheme.colorScheme.tertiaryContainer,
                 style = MaterialTheme.typography.bodySmall,
                 maxLines = 1,
                 modifier = Modifier

+ 40 - 34
app/src/main/java/com/vpn/fastestvpnservice/screens/accountScreensAll/ChangePasswordScreen.kt

@@ -115,7 +115,7 @@ fun ChangePassword(navHostController: NavHostController) {
 //            border = BorderStroke(25.dp, colorResource(id = R.color.black)),
                 colors = ButtonDefaults.buttonColors(
                     contentColor = colorResource(id = R.color.white),
-                    containerColor = colorResource(id = R.color.blue_text),
+                    containerColor = MaterialTheme.colorScheme.onTertiaryContainer,
                 ),
             )
             {
@@ -141,6 +141,10 @@ fun ColumnScope.TextFieldCurrPass() {
     var passwordChanged by remember { mutableStateOf("") }
     var passwordVisible by remember { mutableStateOf(false) }
 
+    val customTextStyle = MaterialTheme.typography.customTypography2.bodyMedium.copy(
+        MaterialTheme.colorScheme.tertiaryContainer
+    )
+
     TextField(
         value = passwordChanged,
         onValueChange = {
@@ -148,7 +152,8 @@ fun ColumnScope.TextFieldCurrPass() {
             passwordChanged = it
         },
 
-        textStyle = MaterialTheme.typography.customTypography2.bodyMedium,
+        textStyle = customTextStyle,
+
         modifier = Modifier
             .padding(start = 15.dp, end = 15.dp)
             .align(Alignment.Start)
@@ -156,7 +161,7 @@ fun ColumnScope.TextFieldCurrPass() {
             .height(60.dp)
             .border(
                 1.dp,
-                color = colorResource(id = R.color.white),
+                color = MaterialTheme.colorScheme.onBackground,
                 shape = RoundedCornerShape(16.dp)
             )
             .background(color = colorResource(id = R.color.transparent)),
@@ -169,7 +174,7 @@ fun ColumnScope.TextFieldCurrPass() {
         label = {
             Text(
                 text = "Current Password",
-                color = colorResource(id = R.color.dark_blue_gray_text),
+                color = MaterialTheme.colorScheme.tertiaryContainer,
                 style = MaterialTheme.typography.labelMedium
             )
         },
@@ -177,7 +182,7 @@ fun ColumnScope.TextFieldCurrPass() {
             androidx.compose.material3.Icon(
                 painter = painterResource(id = R.drawable.lock3x),
                 contentDescription = "Password Logo",
-                tint = colorResource(id = R.color.dark_blue_gray_text),
+                tint = MaterialTheme.colorScheme.tertiaryContainer,
                 modifier = Modifier
                     .size(24.dp, 24.dp)
             )
@@ -185,12 +190,12 @@ fun ColumnScope.TextFieldCurrPass() {
         maxLines = 1,
         colors = TextFieldDefaults.colors(
             focusedLabelColor = Color.Blue,
-            unfocusedContainerColor = colorResource(id = R.color.white),
-            focusedContainerColor = colorResource(id = R.color.white),
+            unfocusedContainerColor = MaterialTheme.colorScheme.onBackground,
+            focusedContainerColor = MaterialTheme.colorScheme.onBackground,
             focusedIndicatorColor = colorResource(id = R.color.transparent),
             disabledIndicatorColor = colorResource(id = R.color.transparent),
             unfocusedIndicatorColor = colorResource(id = R.color.transparent),
-            cursorColor = colorResource(id = R.color.dark_blue_gray_text)
+            cursorColor = MaterialTheme.colorScheme.tertiaryContainer,
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Password,
@@ -222,7 +227,7 @@ fun ColumnScope.TextFieldCurrPass() {
                     androidx.compose.material3.Icon(
                         imageVector = Icons.Outlined.Visibility,
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)
@@ -232,7 +237,7 @@ fun ColumnScope.TextFieldCurrPass() {
                     androidx.compose.material3.Icon(
                         painter = painterResource(id = R.drawable.eye_slash3x),
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)
@@ -250,6 +255,9 @@ fun ColumnScope.TextFieldNewPass() {
 
     var passwordChanged by remember { mutableStateOf("") }
     var passwordVisible by remember { mutableStateOf(false) }
+    val customTextStyle = MaterialTheme.typography.customTypography2.bodyMedium.copy(
+        MaterialTheme.colorScheme.tertiaryContainer
+    )
 
     TextField(
         value = passwordChanged,
@@ -258,10 +266,8 @@ fun ColumnScope.TextFieldNewPass() {
             passwordChanged = it
         },
 
-        textStyle = TextStyle(
-            fontSize = 20.sp,
-            color = colorResource(id = R.color.dark_blue_gray_text),
-        ),
+        textStyle = customTextStyle,
+
         modifier = Modifier
             .padding(start = 15.dp, end = 15.dp)
             .align(Alignment.Start)
@@ -269,7 +275,7 @@ fun ColumnScope.TextFieldNewPass() {
             .height(60.dp)
             .border(
                 1.dp,
-                color = colorResource(id = R.color.white),
+                color = MaterialTheme.colorScheme.onBackground,
                 shape = RoundedCornerShape(16.dp)
             )
             .background(color = colorResource(id = R.color.transparent)),
@@ -282,7 +288,7 @@ fun ColumnScope.TextFieldNewPass() {
         label = {
             androidx.compose.material3.Text(text = "New Password",
                 style = TextStyle(
-                    colorResource(id = R.color.dark_blue_gray_text),
+                    MaterialTheme.colorScheme.tertiaryContainer,
                     fontSize = 16.sp,
                     textAlign = TextAlign.Center
                 )
@@ -292,7 +298,7 @@ fun ColumnScope.TextFieldNewPass() {
             androidx.compose.material3.Icon(
                 painter = painterResource(id = R.drawable.lock3x),
                 contentDescription = "Password Logo",
-                tint = colorResource(id = R.color.dark_blue_gray_text),
+                tint = MaterialTheme.colorScheme.tertiaryContainer,
                 modifier = Modifier
                     .size(24.dp, 24.dp)
             )
@@ -300,12 +306,12 @@ fun ColumnScope.TextFieldNewPass() {
         maxLines = 1,
         colors = TextFieldDefaults.colors(
             focusedLabelColor = Color.Blue,
-            unfocusedContainerColor = colorResource(id = R.color.white),
-            focusedContainerColor = colorResource(id = R.color.white),
+            unfocusedContainerColor = MaterialTheme.colorScheme.onBackground,
+            focusedContainerColor = MaterialTheme.colorScheme.onBackground,
             focusedIndicatorColor = colorResource(id = R.color.transparent),
             disabledIndicatorColor = colorResource(id = R.color.transparent),
             unfocusedIndicatorColor = colorResource(id = R.color.transparent),
-            cursorColor = colorResource(id = R.color.dark_blue_gray_text)
+            cursorColor = MaterialTheme.colorScheme.tertiaryContainer
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Password,
@@ -337,7 +343,7 @@ fun ColumnScope.TextFieldNewPass() {
                     androidx.compose.material3.Icon(
                         imageVector = Icons.Outlined.Visibility,
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)
@@ -347,7 +353,7 @@ fun ColumnScope.TextFieldNewPass() {
                     androidx.compose.material3.Icon(
                         painter = painterResource(id = R.drawable.eye_slash3x),
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)
@@ -365,6 +371,9 @@ fun ColumnScope.TextFieldReWriteNewPass() {
 
     var passwordChanged by remember { mutableStateOf("") }
     var passwordVisible by remember { mutableStateOf(false) }
+    val customTextStyle = MaterialTheme.typography.customTypography2.bodyMedium.copy(
+        MaterialTheme.colorScheme.tertiaryContainer
+    )
 
     TextField(
         value = passwordChanged,
@@ -373,10 +382,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
             passwordChanged = it
         },
 
-        textStyle = TextStyle(
-            fontSize = 20.sp,
-            color = colorResource(id = R.color.dark_blue_gray_text),
-        ),
+        textStyle = customTextStyle,
         modifier = Modifier
             .padding(start = 15.dp, end = 15.dp)
             .align(Alignment.Start)
@@ -384,7 +390,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
             .height(60.dp)
             .border(
                 1.dp,
-                color = colorResource(id = R.color.white),
+                color = MaterialTheme.colorScheme.onBackground,
                 shape = RoundedCornerShape(16.dp)
             )
             .background(color = colorResource(id = R.color.transparent)),
@@ -397,7 +403,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
         label = {
             androidx.compose.material3.Text(text = "Rewrite New Password",
                 style = TextStyle(
-                    colorResource(id = R.color.dark_blue_gray_text),
+                    MaterialTheme.colorScheme.tertiaryContainer,
                     fontSize = 16.sp,
                     textAlign = TextAlign.Center
                 )
@@ -407,7 +413,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
             androidx.compose.material3.Icon(
                 painter = painterResource(id = R.drawable.lock3x),
                 contentDescription = "Password Logo",
-                tint = colorResource(id = R.color.dark_blue_gray_text),
+                tint = MaterialTheme.colorScheme.tertiaryContainer,
                 modifier = Modifier
                     .size(24.dp, 24.dp)
             )
@@ -415,12 +421,12 @@ fun ColumnScope.TextFieldReWriteNewPass() {
         maxLines = 1,
         colors = TextFieldDefaults.colors(
             focusedLabelColor = Color.Blue,
-            unfocusedContainerColor = colorResource(id = R.color.white),
-            focusedContainerColor = colorResource(id = R.color.white),
+            unfocusedContainerColor = MaterialTheme.colorScheme.onBackground,
+            focusedContainerColor = MaterialTheme.colorScheme.onBackground,
             focusedIndicatorColor = colorResource(id = R.color.transparent),
             disabledIndicatorColor = colorResource(id = R.color.transparent),
             unfocusedIndicatorColor = colorResource(id = R.color.transparent),
-            cursorColor = colorResource(id = R.color.dark_blue_gray_text)
+            cursorColor = MaterialTheme.colorScheme.tertiaryContainer
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Password,
@@ -452,7 +458,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
                     androidx.compose.material3.Icon(
                         imageVector = Icons.Outlined.Visibility,
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)
@@ -462,7 +468,7 @@ fun ColumnScope.TextFieldReWriteNewPass() {
                     androidx.compose.material3.Icon(
                         painter = painterResource(id = R.drawable.eye_slash3x),
                         contentDescription = description,
-                        tint = colorResource(id = R.color.dark_blue_gray_text),
+                        tint = MaterialTheme.colorScheme.tertiaryContainer,
                         modifier = Modifier
                             .size(24.dp)
                             .alpha(0.5F)

+ 1 - 1
app/src/main/java/com/vpn/fastestvpnservice/screens/bottomNavBarScreens/AccountScreen.kt

@@ -414,7 +414,7 @@ fun BoxScope.LogoutDialog(
             verticalArrangement = Arrangement.Top,
             horizontalAlignment = Alignment.CenterHorizontally,
             modifier = Modifier
-                .background(MaterialTheme.colorScheme.onPrimary)
+                .background(MaterialTheme.colorScheme.onBackground)
         ) {
             Log.d("islogoutClicked", "AlertDialog")
 

+ 11 - 9
app/src/main/java/com/vpn/fastestvpnservice/screens/bottomNavBarScreens/SettingsScreen.kt

@@ -167,11 +167,13 @@ fun Settings(navHostController: NavHostController) {
 //                icon = R.drawable.autoconnect3x,
 //                text = "Auto Connect"
 //            )
-            AddRowSettings(
-                icon = R.drawable.autoconnect3x,
-                text = "Auto Connect",
-                onClick = {}
-            )
+
+            /* Commenting so far ...*/
+//            AddRowSettings(
+//                icon = R.drawable.autoconnect3x,
+//                text = "Auto Connect",
+//                onClick = {}
+//            )
             AddRowSettingsSmart(
                 icon = R.drawable.smart_connect3x,
                 text = "Smart Connect",
@@ -470,7 +472,7 @@ fun ColumnScope.AddRowSettingsColumn(
             ModalBottomSheet(
                 onDismissRequest = { isSheetOpen = false },
                 sheetState = sheetState,
-                containerColor = MaterialTheme.colorScheme.background
+                containerColor = MaterialTheme.colorScheme.onBackground
             ) {
                 Box(modifier = Modifier
                     .background(Color.Transparent)
@@ -671,7 +673,7 @@ fun AddRowDarkLightTheme(
             onDismissRequest = { isThemeSheetOpen = false
             },
             sheetState = sheetState,
-            containerColor = MaterialTheme.colorScheme.background
+            containerColor = MaterialTheme.colorScheme.onBackground
         ) {
             Box(modifier = Modifier
                 .background(Color.Transparent)
@@ -872,7 +874,7 @@ fun ColumnScope.AddRowSettingsSmart(
                 BottomBarScreen.Settings.isTrue = false
                                },
             sheetState = sheetState,
-            containerColor = MaterialTheme.colorScheme.background
+            containerColor = MaterialTheme.colorScheme.onBackground
         ) {
             Box(modifier = Modifier
                 .background(Color.Transparent)
@@ -954,7 +956,7 @@ fun ColumnScope.AddRowSettingsSmart(
                 BottomBarScreen.Settings.isTrue = false
             },
             sheetState = sheetStateAny,
-            containerColor = MaterialTheme.colorScheme.background,
+            containerColor = MaterialTheme.colorScheme.onBackground,
             modifier = Modifier.padding(top = 50.dp)
         ) {
             Box(modifier = Modifier

+ 11 - 1
app/src/main/java/com/vpn/fastestvpnservice/ui/theme/Theme.kt

@@ -37,9 +37,14 @@ private val DarkColorScheme = darkColorScheme(
 
     tertiary = Color.White,
     onTertiary = Color(0xFFc1c1bd),
+    tertiaryContainer = Color(0xFF858C93), // grayIcon
+    onTertiaryContainer = Color(0xFF113289),
+
+    surface = Color.White,
+    surfaceBright = Color.White,
 
     background = Color(0xFF121212),
-    onBackground = Color(0xFF2d2d2d)
+    onBackground = Color(0xFF2d2d2d) // background for dark theme
 )
 
 private val LightColorScheme = lightColorScheme(
@@ -56,6 +61,11 @@ private val LightColorScheme = lightColorScheme(
 
     tertiary = Color(0xFF2952c3),
     onTertiary = Color(0xFF0d1a2a),
+    tertiaryContainer = Color(0xFF0d1a2a), // darkBlueGrey
+    onTertiaryContainer = Color(0xFF3B6AEE), // blue_text
+
+    surface = Color(0xFF4071fb), // light_blue_2
+    surfaceBright = Color(0xFF36485e), // text_color_dark_gray
 
     background = Color(0xFFf3f3f3),
     onBackground = Color.White

+ 1 - 0
app/src/main/res/values/colors.xml

@@ -28,6 +28,7 @@
     <color name="dark_blue_gray_text">#0d1a2a</color>   // darkBlueGrey
     <color name="dark_blue_gray_text2">#0d1b2a</color>
     <color name="text_color_dark_gray">#36485e</color>  // darkGreyBlue
+    <color name="gray_opac_04">#818181</color>
     <color name="dark_black_gray">#2d2d2d</color>
     <color name="pink_color">#bd9fa7</color>
     <color name="maroon_text">#a61c3c</color>