diff --git a/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarComposable.kt b/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarComposable.kt index 27fb605..e9b2b0e 100644 --- a/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarComposable.kt +++ b/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarComposable.kt @@ -12,12 +12,14 @@ import androidx.compose.material.icons.outlined.DateRange import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN +import be.ugent.sel.studeez.navigation.StudeezDestinations.PROFILE_SCREEN import be.ugent.sel.studeez.resources import be.ugent.sel.studeez.ui.theme.StudeezTheme import be.ugent.sel.studeez.R.string as AppText data class NavigationBarActions( - val selectedTab: (Int) -> Boolean, + val selectedTab: (String) -> Boolean, val onHomeClick: () -> Unit, val onTasksClick: () -> Unit, val onSessionsClick: () -> Unit, @@ -56,7 +58,7 @@ fun NavigationBar( BottomNavigationItem( icon = { Icon(imageVector = Icons.Default.List, resources().getString(AppText.home)) }, label = { Text(text = resources().getString(AppText.home)) }, - selected = navigationBarActions.selectedTab(0), + selected = navigationBarActions.selectedTab(HOME_SCREEN), onClick = navigationBarActions.onHomeClick ) @@ -67,7 +69,8 @@ fun NavigationBar( ) }, label = { Text(text = resources().getString(AppText.tasks)) }, - selected = navigationBarActions.selectedTab(1), + // TODO selected = navigationBarActions.selectedTab(TASKS_SCREEN), + selected = false, onClick = navigationBarActions.onTasksClick ) @@ -81,7 +84,8 @@ fun NavigationBar( ) }, label = { Text(text = resources().getString(AppText.sessions)) }, - selected = navigationBarActions.selectedTab(2), + // TODO selected = navigationBarActions.selectedTab(SESSIONS_SCREEN), + selected = false, onClick = navigationBarActions.onSessionsClick ) @@ -92,7 +96,7 @@ fun NavigationBar( ) }, label = { Text(text = resources().getString(AppText.profile)) }, - selected = navigationBarActions.selectedTab(3), + selected = navigationBarActions.selectedTab(PROFILE_SCREEN), onClick = navigationBarActions.onProfileClick ) diff --git a/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarViewModel.kt b/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarViewModel.kt index 58a75ef..cadec72 100644 --- a/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarViewModel.kt +++ b/app/src/main/java/be/ugent/sel/studeez/common/composable/navbar/NavigationBarViewModel.kt @@ -16,32 +16,32 @@ class NavigationBarViewModel @Inject constructor( logService: LogService ) : StudeezViewModel(logService) { - fun isSelected(index: Int): Boolean { - return index == selectedTab.selectedTab + fun isSelected(screen: String): Boolean { + return screen == selectedTab.selectedTab } fun onHomeClick(open: (String) -> Unit) { - selectedTab.selectedTab = 0 + selectedTab.selectedTab = HOME_SCREEN open(HOME_SCREEN) } fun onTasksClick(open: (String) -> Unit) { // TODO - selectedTab.selectedTab = 1 + // selectedTab.selectedTab = TASKS_SCREEN } fun onSessionsClick(open: (String) -> Unit) { // TODO - selectedTab.selectedTab = 2 + // selectedTab.selectedTab = SESSIONS_SCREEN } fun onProfileClick(open: (String) -> Unit) { - selectedTab.selectedTab = 3 + selectedTab.selectedTab = PROFILE_SCREEN open(PROFILE_SCREEN) } } @Singleton class SelectedTabState @Inject constructor() { - var selectedTab: Int = 0 + var selectedTab: String = HOME_SCREEN } \ No newline at end of file