Selaa lähdekoodia

update theme color for bottomnavbar and remove focus/highlighted color when tap in item..

Khubaib 1 vuosi sitten
vanhempi
commit
564ebc6ceb

+ 21 - 15
app/src/main/java/com/vpn/fastestvpnservice/screens/BottomBarMainScreen.kt

@@ -27,6 +27,7 @@ import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.remember
 import androidx.compose.runtime.setValue
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
@@ -41,6 +42,7 @@ import androidx.navigation.compose.rememberNavController
 import com.vpn.fastestvpnservice.R
 import com.vpn.fastestvpnservice.navigation.BottomBarNavGraph
 import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
+import com.vpn.fastestvpnservice.ui.theme.customTypography2
 
 @Composable
 fun BottomBarMainScreen(navController: NavHostController, activity: ComponentActivity) {
@@ -61,9 +63,9 @@ fun BottomBarMainScreen(navController: NavHostController, activity: ComponentAct
 
     Scaffold (
         bottomBar = {
-                    if (isBottomBarVisible) {
-                        BottomBar(navController1, screens)
-                    }
+            if (isBottomBarVisible) {
+                BottomBar(navController1, screens)
+            }
         },
         content = { padding ->
             Box(modifier = Modifier.padding(padding)) {
@@ -86,8 +88,9 @@ fun BottomBar(navHostController: NavHostController, screens: List<BottomBarScree
 
 
     BottomNavigation (
-        backgroundColor = MaterialTheme.colorScheme.onPrimary,
-        contentColor = Color.Gray,
+        backgroundColor = MaterialTheme.colorScheme.onBackground,
+        elevation = 0.dp,
+//        contentColor = Color.Gray,
         modifier = Modifier.height(84.dp)
     ) {
         screens.forEach { screen ->
@@ -112,14 +115,17 @@ fun RowScope.AddItem(
         label = {
             if (currentDestination?.route == screen.route) {
                 Text(text = screen.title,
-                    color = colorResource(id = R.color.blue_text),
+                    style = MaterialTheme.typography.customTypography2.bodyLarge,
+                    color = MaterialTheme.colorScheme.tertiary,
                     )
             }
             else {
                 Text(text = screen.title,
-                    color = Color.Gray)
+                    style = MaterialTheme.typography.customTypography2.bodyLarge,
+                    color = MaterialTheme.colorScheme.onTertiary,
+                    modifier = Modifier.alpha(0.5F)
+                )
             }
-
         },
         alwaysShowLabel = true,
         selected = currentDestination?.hierarchy?.any{
@@ -150,10 +156,10 @@ fun RowScope.AddItem(
                 Icon(
                     painter = painterResource(id = screen.icon),
                     contentDescription = "Navigation Icon",
-                    tint = colorResource(id = R.color.dark_blue_icon),
+                    tint = MaterialTheme.colorScheme.tertiary,
                     modifier = Modifier
                         .size(45.dp, 39.dp)
-                        .padding(top = 9.dp, bottom = 7.dp)
+                        .padding(top = 9.dp, bottom = 4.dp)
 
                 )
             }
@@ -161,16 +167,16 @@ fun RowScope.AddItem(
                 Icon(
                     painter = painterResource(id = screen.icon),
                     contentDescription = "Navigation Icon",
-                    tint = colorResource(id = R.color.gray_icon),
+                    tint = MaterialTheme.colorScheme.onTertiary,
                     modifier = Modifier
                         .size(45.dp, 39.dp)
-                        .padding(top = 9.dp, bottom = 7.dp)                )
+                        .padding(top = 9.dp, bottom = 4.dp)
+                        .alpha(0.5F))
             }
 
         },
-        unselectedContentColor = LocalContentColor.current.copy(
-            alpha = ContentAlpha.disabled
-        )
+        unselectedContentColor = MaterialTheme.colorScheme.onBackground,
+        selectedContentColor = MaterialTheme.colorScheme.onBackground
     )
 }
 

+ 6 - 2
app/src/main/java/com/vpn/fastestvpnservice/ui/theme/Theme.kt

@@ -30,8 +30,10 @@ private val DarkColorScheme = darkColorScheme(
     secondary = Color.White,
     onSecondary = Color.White,
     tertiary = Color.White,
+    onTertiary = Color(0xFFc1c1bd),
 
-    background = Color.Black
+    background = Color(0xFF121212),
+    onBackground = Color(0xFF2d2d2d)
 )
 
 private val LightColorScheme = lightColorScheme(
@@ -41,8 +43,10 @@ private val LightColorScheme = lightColorScheme(
     secondary = Color.Black,
     onSecondary = Color(0xFF0d1b2a),
     tertiary = Color(0xFF2952c3),
+    onTertiary = Color(0xFF0d1a2a),
 
-    background = Color(0xFFf3f3f3)
+    background = Color(0xFFf3f3f3),
+    onBackground = Color.White
 
     /* Other default colors to override
     background = Color(0xFFFFFBFE),

+ 8 - 0
app/src/main/java/com/vpn/fastestvpnservice/ui/theme/Type.kt

@@ -259,5 +259,13 @@ val Typography.customTypography2: Typography
             lineHeight = 22.sp,
             letterSpacing = 0.21.sp,
             color = colorResource(id = R.color.dark_blue_gray_text)
+        ),
+        bodyLarge = TextStyle(
+            fontFamily = outfitFontFamily,
+            fontWeight = FontWeight.Normal,
+            fontSize = 11.sp,
+            textAlign = TextAlign.Center,
+            letterSpacing = (-0.26).sp,
         )
+
     )

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

@@ -25,6 +25,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="dark_black_gray">#2d2d2d</color>
     <color name="pink_color">#bd9fa7</color>
     <color name="maroon_text">#a61c3c</color>
     <color name="switch_green">#17AA5D</color>