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
|
openDialog = true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
mainViewModel.topBarIcon = Icons.Outlined.ArrowBack
|
mainViewModel.topBarIcon = Icons.Outlined.Menu
|
||||||
mainViewModel.topBarTitle = stringResource(R.string.menu_history)
|
mainViewModel.topBarTitle = stringResource(R.string.menu_history)
|
||||||
mainViewModel.topBarNavigationAction =
|
mainViewModel.topBarNavigationAction =
|
||||||
NavigationAction { navController.navigate("counter") }
|
NavigationAction { scope.launch { drawerState.open() } }
|
||||||
}
|
}
|
||||||
composable("settings") {
|
composable("settings") {
|
||||||
SettingsView(settingsViewModel)
|
SettingsView(settingsViewModel)
|
||||||
mainViewModel.topBarActions = emptyList()
|
mainViewModel.topBarActions = emptyList()
|
||||||
mainViewModel.topBarIcon = Icons.Outlined.ArrowBack
|
mainViewModel.topBarIcon = Icons.Outlined.Menu
|
||||||
mainViewModel.topBarTitle = stringResource(R.string.menu_settings)
|
mainViewModel.topBarTitle = stringResource(R.string.menu_settings)
|
||||||
mainViewModel.topBarNavigationAction =
|
mainViewModel.topBarNavigationAction =
|
||||||
NavigationAction { navController.navigate("counter") }
|
NavigationAction { scope.launch { drawerState.open() } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,6 +193,7 @@ class MainActivity : BaseActivity() {
|
|||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
|
|
||||||
val items = listOf(
|
val items = listOf(
|
||||||
|
Screen("counter", Icons.Outlined.Calculate, R.string.app_name),
|
||||||
Screen("history", Icons.Outlined.List, R.string.menu_history),
|
Screen("history", Icons.Outlined.List, R.string.menu_history),
|
||||||
Screen("settings", Icons.Outlined.Settings, R.string.menu_settings)
|
Screen("settings", Icons.Outlined.Settings, R.string.menu_settings)
|
||||||
)
|
)
|
||||||
@@ -211,7 +212,7 @@ class MainActivity : BaseActivity() {
|
|||||||
NavigationDrawerItem(
|
NavigationDrawerItem(
|
||||||
icon = { Icon(Icons.Outlined.RestartAlt, contentDescription = null) },
|
icon = { Icon(Icons.Outlined.RestartAlt, contentDescription = null) },
|
||||||
colors = NavigationDrawerItemDefaults.colors(
|
colors = NavigationDrawerItemDefaults.colors(
|
||||||
unselectedContainerColor = MaterialTheme.colorScheme.secondaryContainer
|
unselectedContainerColor = MaterialTheme.colorScheme.primaryContainer
|
||||||
),
|
),
|
||||||
label = { Text(stringResource(R.string.newGame)) },
|
label = { Text(stringResource(R.string.newGame)) },
|
||||||
selected = false,
|
selected = false,
|
||||||
@@ -219,25 +220,17 @@ class MainActivity : BaseActivity() {
|
|||||||
scope.launch { drawerState.close() }
|
scope.launch { drawerState.close() }
|
||||||
mainViewModel.newGame()
|
mainViewModel.newGame()
|
||||||
navController.navigate("counter") {
|
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) {
|
popUpTo(navController.graph.findStartDestination().id) {
|
||||||
saveState = true
|
saveState = true
|
||||||
}
|
}
|
||||||
// Avoid multiple copies of the same destination when
|
|
||||||
// reselecting the same item
|
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
// Restore state when reselecting a previously selected item
|
|
||||||
restoreState = true
|
restoreState = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(20.dp))
|
Divider(Modifier.padding(top = 20.dp, bottom = 20.dp))
|
||||||
|
|
||||||
Divider()
|
|
||||||
|
|
||||||
items.forEach { screen ->
|
items.forEach { screen ->
|
||||||
NavigationDrawerItem(
|
NavigationDrawerItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user