diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt
index 7f87b7616..add74e026 100644
--- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt
+++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt
@@ -4,7 +4,9 @@ import android.os.Parcelable
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBarItem
+import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -82,6 +84,7 @@ fun VaultUnlockedNavBarScreen(
* Scaffold that contains the bottom nav bar for the [VaultUnlockedNavBarScreen]
*/
@Composable
+@Suppress("LongMethod")
private fun VaultUnlockedNavBarScaffold(
navController: NavHostController,
vaultTabClickedAction: () -> Unit,
@@ -91,7 +94,9 @@ private fun VaultUnlockedNavBarScaffold(
) {
Scaffold(
bottomBar = {
- BottomAppBar {
+ BottomAppBar(
+ containerColor = MaterialTheme.colorScheme.surfaceContainer,
+ ) {
val destinations = listOf(
VaultUnlockedNavBarTab.Vault,
VaultUnlockedNavBarTab.Send,
@@ -101,21 +106,35 @@ private fun VaultUnlockedNavBarScaffold(
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
destinations.forEach { destination ->
+
+ val isSelected = currentDestination?.hierarchy?.any {
+ it.route == destination.route
+ } == true
+
NavigationBarItem(
icon = {
Icon(
- painter = painterResource(id = destination.iconRes),
+ painter = painterResource(
+ id = if (isSelected) {
+ destination.iconResSelected
+ } else {
+ destination.iconRes
+ },
+ ),
contentDescription = stringResource(
id = destination.contentDescriptionRes,
),
+ tint = if (isSelected) {
+ MaterialTheme.colorScheme.onSecondaryContainer
+ } else {
+ MaterialTheme.colorScheme.onSurface
+ },
)
},
label = {
Text(text = stringResource(id = destination.labelRes))
},
- selected = currentDestination?.hierarchy?.any {
- it.route == destination.route
- } == true,
+ selected = isSelected,
onClick = {
when (destination) {
VaultUnlockedNavBarTab.Vault -> vaultTabClickedAction()
@@ -124,6 +143,9 @@ private fun VaultUnlockedNavBarScaffold(
VaultUnlockedNavBarTab.Settings -> settingsTabClickedAction()
}
},
+ colors = NavigationBarItemDefaults.colors(
+ indicatorColor = MaterialTheme.colorScheme.secondaryContainer,
+ ),
)
}
}
@@ -143,10 +165,24 @@ private fun VaultUnlockedNavBarScaffold(
}
/**
- * Models tabs for the nav bar of the vault unlocked portion of the app.
+ * Represents the different tabs available in the navigation bar
+ * for the unlocked portion of the vault.
+ *
+ * Each tab is modeled with properties that provide information on:
+ * - Regular icon resource
+ * - Icon resource when selected
+ * and other essential UI and navigational data.
+ *
+ * @property iconRes The resource ID for the regular (unselected) icon representing the tab.
+ * @property iconResSelected The resource ID for the icon representing the tab when it's selected.
*/
@Parcelize
private sealed class VaultUnlockedNavBarTab : Parcelable {
+ /**
+ * The resource ID for the icon representing the tab when it is selected.
+ */
+ abstract val iconResSelected: Int
+
/**
* Resource id for the icon representing the tab.
*/
@@ -172,7 +208,8 @@ private sealed class VaultUnlockedNavBarTab : Parcelable {
*/
@Parcelize
data object Generator : VaultUnlockedNavBarTab() {
- override val iconRes get() = R.drawable.generator_icon
+ override val iconResSelected get() = R.drawable.ic_generator_filled
+ override val iconRes get() = R.drawable.ic_generator
override val labelRes get() = R.string.generator
override val contentDescriptionRes get() = R.string.generator
override val route get() = GENERATOR_ROUTE
@@ -183,7 +220,8 @@ private sealed class VaultUnlockedNavBarTab : Parcelable {
*/
@Parcelize
data object Send : VaultUnlockedNavBarTab() {
- override val iconRes get() = R.drawable.send_icon
+ override val iconResSelected get() = R.drawable.ic_send_filled
+ override val iconRes get() = R.drawable.ic_send
override val labelRes get() = R.string.send
override val contentDescriptionRes get() = R.string.send
override val route get() = SEND_ROUTE
@@ -194,7 +232,8 @@ private sealed class VaultUnlockedNavBarTab : Parcelable {
*/
@Parcelize
data object Vault : VaultUnlockedNavBarTab() {
- override val iconRes get() = R.drawable.sheild_icon
+ override val iconResSelected get() = R.drawable.ic_vault_filled
+ override val iconRes get() = R.drawable.ic_vault
override val labelRes get() = R.string.my_vault
override val contentDescriptionRes get() = R.string.my_vault
override val route get() = VAULT_ROUTE
@@ -205,7 +244,8 @@ private sealed class VaultUnlockedNavBarTab : Parcelable {
*/
@Parcelize
data object Settings : VaultUnlockedNavBarTab() {
- override val iconRes get() = R.drawable.settings_icon
+ override val iconResSelected get() = R.drawable.ic_settings_filled
+ override val iconRes get() = R.drawable.ic_settings
override val labelRes get() = R.string.settings
override val contentDescriptionRes get() = R.string.settings
override val route get() = SETTINGS_ROUTE
diff --git a/app/src/main/res/drawable/generator_icon.xml b/app/src/main/res/drawable/generator_icon.xml
deleted file mode 100644
index 8a6aa8028..000000000
--- a/app/src/main/res/drawable/generator_icon.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_generator.xml b/app/src/main/res/drawable/ic_generator.xml
new file mode 100644
index 000000000..12d406d3e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_generator.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_generator_filled.xml b/app/src/main/res/drawable/ic_generator_filled.xml
new file mode 100644
index 000000000..4cb328ae4
--- /dev/null
+++ b/app/src/main/res/drawable/ic_generator_filled.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_send.xml b/app/src/main/res/drawable/ic_send.xml
new file mode 100644
index 000000000..57fae9d4c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_send.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_send_filled.xml b/app/src/main/res/drawable/ic_send_filled.xml
new file mode 100644
index 000000000..c77d7ad88
--- /dev/null
+++ b/app/src/main/res/drawable/ic_send_filled.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml
new file mode 100644
index 000000000..3f24fbb97
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_settings_filled.xml b/app/src/main/res/drawable/ic_settings_filled.xml
new file mode 100644
index 000000000..118c06747
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings_filled.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_vault.xml b/app/src/main/res/drawable/ic_vault.xml
new file mode 100644
index 000000000..4dc2f370c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_vault.xml
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_vault_filled.xml b/app/src/main/res/drawable/ic_vault_filled.xml
new file mode 100644
index 000000000..010db470c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_vault_filled.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/send_icon.xml b/app/src/main/res/drawable/send_icon.xml
deleted file mode 100644
index 0329c660a..000000000
--- a/app/src/main/res/drawable/send_icon.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/settings_icon.xml b/app/src/main/res/drawable/settings_icon.xml
deleted file mode 100644
index f99bf396e..000000000
--- a/app/src/main/res/drawable/settings_icon.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/sheild_icon.xml b/app/src/main/res/drawable/sheild_icon.xml
deleted file mode 100644
index b6691cf56..000000000
--- a/app/src/main/res/drawable/sheild_icon.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-