From 1bbda75c6a1650cc0f8d0d8ad986aff8f060dd44 Mon Sep 17 00:00:00 2001 From: remain Date: Wed, 12 Jun 2024 11:54:45 +0800 Subject: [PATCH] Fix for issue #376: Fix tab highlighting for Single Account navigation --- .../main/java/com/example/compose/rally/RallyActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NavigationCodelab/app/src/main/java/com/example/compose/rally/RallyActivity.kt b/NavigationCodelab/app/src/main/java/com/example/compose/rally/RallyActivity.kt index 8fda762ed..448665e44 100644 --- a/NavigationCodelab/app/src/main/java/com/example/compose/rally/RallyActivity.kt +++ b/NavigationCodelab/app/src/main/java/com/example/compose/rally/RallyActivity.kt @@ -49,7 +49,11 @@ fun RallyApp() { val currentBackStack by navController.currentBackStackEntryAsState() val currentDestination = currentBackStack?.destination val currentScreen = - rallyTabRowScreens.find { it.route == currentDestination?.route } ?: Overview + rallyTabRowScreens.find { + it.route == currentDestination?.route || (it == Accounts && currentDestination?.route?.startsWith( + SingleAccount.route + ) == true) + } ?: Overview Scaffold( topBar = {