From 7532a121c585541b8c1e23374a5b9a8d3f3dbaa3 Mon Sep 17 00:00:00 2001 From: Kanake <10kanake@gmail.com> Date: Sat, 5 Oct 2024 03:23:25 +0300 Subject: [PATCH 1/2] adds label to the bottomnav items --- .../johnoreilly/fantasypremierleague/MainActivity.kt | 2 ++ .../presentation/ScreenAndBottomNavigationItems.kt | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/dev/johnoreilly/fantasypremierleague/MainActivity.kt b/app/src/main/java/dev/johnoreilly/fantasypremierleague/MainActivity.kt index 84d04340..ca4fbf18 100644 --- a/app/src/main/java/dev/johnoreilly/fantasypremierleague/MainActivity.kt +++ b/app/src/main/java/dev/johnoreilly/fantasypremierleague/MainActivity.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.material.Text import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar @@ -133,6 +134,7 @@ private fun FantasyPremierLeagueBottomNavigation(navController: NavHostControlle ) }, selected = currentRoute == bottomNavigationItem.route, + label = { Text(text = bottomNavigationItem.label)}, onClick = { navController.navigate(bottomNavigationItem.route) { popUpTo(navController.graph.id) diff --git a/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt b/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt index b6a28e5a..62e6cb27 100644 --- a/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt +++ b/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt @@ -18,23 +18,27 @@ sealed class Screen(val title: String) { data class BottomNavigationitem( val route: String, val icon: ImageVector, - val iconContentDescription: String + val iconContentDescription: String, + val label: String ) val bottomNavigationItems = listOf( BottomNavigationitem( Screen.PlayerListScreen.title, Icons.Default.Person, - "Player" + "Player", + label = "Players" ), BottomNavigationitem( Screen.FixtureListScreen.title, Icons.Filled.DateRange, - "Fixtures" + "Fixtures", + label = "Fixtures" ), BottomNavigationitem( Screen.LeagueStandingsListScreen.title, Icons.Filled.List, - "League" + "League", + label = "League" ) ) \ No newline at end of file From 24a70266665bd6e43bfa982a499701f26fe4b556 Mon Sep 17 00:00:00 2001 From: Kanake <10kanake@gmail.com> Date: Sat, 5 Oct 2024 03:31:45 +0300 Subject: [PATCH 2/2] use named `iconContentDescription` for better readability. --- .../presentation/ScreenAndBottomNavigationItems.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt b/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt index 62e6cb27..150ea17b 100644 --- a/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt +++ b/app/src/main/java/dev/johnoreilly/fantasypremierleague/presentation/ScreenAndBottomNavigationItems.kt @@ -26,19 +26,19 @@ val bottomNavigationItems = listOf( BottomNavigationitem( Screen.PlayerListScreen.title, Icons.Default.Person, - "Player", + iconContentDescription = "Player", label = "Players" ), BottomNavigationitem( Screen.FixtureListScreen.title, Icons.Filled.DateRange, - "Fixtures", + iconContentDescription = "Fixtures", label = "Fixtures" ), BottomNavigationitem( Screen.LeagueStandingsListScreen.title, Icons.Filled.List, - "League", + iconContentDescription = "League", label = "League" ) ) \ No newline at end of file