Add counter again to navigation.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -131,18 +131,18 @@ class MainActivity : BaseActivity() {
|
||||
openDialog = true
|
||||
}
|
||||
)
|
||||
mainViewModel.topBarIcon = Icons.Outlined.ArrowBack
|
||||
mainViewModel.topBarIcon = Icons.Outlined.Menu
|
||||
mainViewModel.topBarTitle = stringResource(R.string.menu_history)
|
||||
mainViewModel.topBarNavigationAction =
|
||||
NavigationAction { navController.navigate("counter") }
|
||||
NavigationAction { scope.launch { drawerState.open() } }
|
||||
}
|
||||
composable("settings") {
|
||||
SettingsView(settingsViewModel)
|
||||
mainViewModel.topBarActions = emptyList()
|
||||
mainViewModel.topBarIcon = Icons.Outlined.ArrowBack
|
||||
mainViewModel.topBarIcon = Icons.Outlined.Menu
|
||||
mainViewModel.topBarTitle = stringResource(R.string.menu_settings)
|
||||
mainViewModel.topBarNavigationAction =
|
||||
NavigationAction { navController.navigate("counter") }
|
||||
NavigationAction { scope.launch { drawerState.open() } }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,6 +193,7 @@ class MainActivity : BaseActivity() {
|
||||
val navController = rememberNavController()
|
||||
|
||||
val items = listOf(
|
||||
Screen("counter", Icons.Outlined.Calculate, R.string.app_name),
|
||||
Screen("history", Icons.Outlined.List, R.string.menu_history),
|
||||
Screen("settings", Icons.Outlined.Settings, R.string.menu_settings)
|
||||
)
|
||||
@@ -211,7 +212,7 @@ class MainActivity : BaseActivity() {
|
||||
NavigationDrawerItem(
|
||||
icon = { Icon(Icons.Outlined.RestartAlt, contentDescription = null) },
|
||||
colors = NavigationDrawerItemDefaults.colors(
|
||||
unselectedContainerColor = MaterialTheme.colorScheme.secondaryContainer
|
||||
unselectedContainerColor = MaterialTheme.colorScheme.primaryContainer
|
||||
),
|
||||
label = { Text(stringResource(R.string.newGame)) },
|
||||
selected = false,
|
||||
@@ -219,25 +220,17 @@ class MainActivity : BaseActivity() {
|
||||
scope.launch { drawerState.close() }
|
||||
mainViewModel.newGame()
|
||||
navController.navigate("counter") {
|
||||
// Pop up to the start destination of the graph to
|
||||
// avoid building up a large stack of destinations
|
||||
// on the back stack as users select items
|
||||
popUpTo(navController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
// Avoid multiple copies of the same destination when
|
||||
// reselecting the same item
|
||||
launchSingleTop = true
|
||||
// Restore state when reselecting a previously selected item
|
||||
restoreState = true
|
||||
}
|
||||
},
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(20.dp))
|
||||
|
||||
Divider()
|
||||
Divider(Modifier.padding(top = 20.dp, bottom = 20.dp))
|
||||
|
||||
items.forEach { screen ->
|
||||
NavigationDrawerItem(
|
||||
|
||||
Reference in New Issue
Block a user