diff --git a/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt b/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt index f1141fd..9d071c7 100644 --- a/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt +++ b/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt @@ -30,7 +30,6 @@ import be.ugent.sel.studeez.screens.log_in.LoginRoute import be.ugent.sel.studeez.screens.profile.EditProfileRoute import be.ugent.sel.studeez.screens.profile.ProfileRoute import be.ugent.sel.studeez.screens.session.SessionRoute -import be.ugent.sel.studeez.screens.session.SessionScreen import be.ugent.sel.studeez.screens.sign_up.SignUpRoute import be.ugent.sel.studeez.screens.splash.SplashRoute import be.ugent.sel.studeez.screens.timer_overview.TimerOverviewRoute diff --git a/app/src/main/java/be/ugent/sel/studeez/common/composable/TimerEntry.kt b/app/src/main/java/be/ugent/sel/studeez/common/composable/TimerEntry.kt index 12f1738..bfa2711 100644 --- a/app/src/main/java/be/ugent/sel/studeez/common/composable/TimerEntry.kt +++ b/app/src/main/java/be/ugent/sel/studeez/common/composable/TimerEntry.kt @@ -1,6 +1,5 @@ package be.ugent.sel.studeez.common.composable -import androidx.annotation.StringRes import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -21,9 +20,7 @@ import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo @Composable fun TimerEntry( timerInfo: TimerInfo, - showButton: Boolean, - @StringRes buttonName: Int = -1, - onButtonClick: (TimerInfo) -> Unit = {} + button: @Composable () -> Unit, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -40,12 +37,7 @@ fun TimerEntry( text = timerInfo.description, fontWeight = FontWeight.Light, fontSize = 15.sp ) } - if (showButton) { - StealthButton(buttonName) { - onButtonClick(timerInfo) - } - } - + button() } } @@ -55,7 +47,9 @@ fun TimerEntryPreview() { val timerInfo = CustomTimerInfo( "my preview timer", "This is the description of the timer", 60 ) - TimerEntry(timerInfo = timerInfo, true, buttonName = R.string.edit) { } + TimerEntry(timerInfo = timerInfo) { + StealthButton(text = R.string.edit) {} + } } @Preview @@ -64,5 +58,5 @@ fun TimerDefaultEntryPreview() { val timerInfo = CustomTimerInfo( "Default preview timer", "This is the description of the timer", 60 ) - TimerEntry(timerInfo = timerInfo, false, buttonName = R.string.edit) { } + TimerEntry(timerInfo = timerInfo) {} } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/sel/studeez/common/composable/drawer/DrawerComposable.kt b/app/src/main/java/be/ugent/sel/studeez/common/composable/drawer/DrawerComposable.kt index 518075e..47571f5 100644 --- a/app/src/main/java/be/ugent/sel/studeez/common/composable/drawer/DrawerComposable.kt +++ b/app/src/main/java/be/ugent/sel/studeez/common/composable/drawer/DrawerComposable.kt @@ -89,7 +89,9 @@ fun Drawer( @Composable fun DrawerEntry( - icon: ImageVector, text: String, onClick: () -> Unit + icon: ImageVector, + text: String, + onClick: () -> Unit ) { Row( horizontalArrangement = Arrangement.Center, diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeScreen.kt b/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeScreen.kt index 08d62ea..d989966 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeScreen.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeScreen.kt @@ -11,14 +11,12 @@ import androidx.hilt.navigation.compose.hiltViewModel import be.ugent.sel.studeez.R import be.ugent.sel.studeez.common.composable.BasicButton import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate -import be.ugent.sel.studeez.common.ext.basicButton -import be.ugent.sel.studeez.resources import be.ugent.sel.studeez.common.composable.drawer.DrawerActions -import be.ugent.sel.studeez.common.composable.drawer.DrawerViewModel import be.ugent.sel.studeez.common.composable.drawer.getDrawerActions import be.ugent.sel.studeez.common.composable.navbar.NavigationBarActions -import be.ugent.sel.studeez.common.composable.navbar.NavigationBarViewModel import be.ugent.sel.studeez.common.composable.navbar.getNavigationBarActions +import be.ugent.sel.studeez.common.ext.basicButton +import be.ugent.sel.studeez.resources @Composable fun HomeRoute( diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/timer_overview/TimerOverviewScreen.kt b/app/src/main/java/be/ugent/sel/studeez/screens/timer_overview/TimerOverviewScreen.kt index 5d597e0..2a1435e 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/timer_overview/TimerOverviewScreen.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/timer_overview/TimerOverviewScreen.kt @@ -13,15 +13,16 @@ import androidx.hilt.navigation.compose.hiltViewModel import be.ugent.sel.studeez.R import be.ugent.sel.studeez.common.composable.BasicButton import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate +import be.ugent.sel.studeez.common.composable.StealthButton import be.ugent.sel.studeez.common.composable.TimerEntry -import be.ugent.sel.studeez.common.ext.basicButton -import be.ugent.sel.studeez.data.local.models.timer_info.CustomTimerInfo -import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo -import be.ugent.sel.studeez.resources import be.ugent.sel.studeez.common.composable.drawer.DrawerActions import be.ugent.sel.studeez.common.composable.drawer.getDrawerActions import be.ugent.sel.studeez.common.composable.navbar.NavigationBarActions import be.ugent.sel.studeez.common.composable.navbar.getNavigationBarActions +import be.ugent.sel.studeez.common.ext.basicButton +import be.ugent.sel.studeez.data.local.models.timer_info.CustomTimerInfo +import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo +import be.ugent.sel.studeez.resources import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @@ -75,16 +76,18 @@ fun TimerOverviewScreen( ) { // Default Timers, cannot be edited items(timerOverviewActions.getDefaultTimers()) { - TimerEntry(timerInfo = it, showButton = false) + TimerEntry(timerInfo = it) {} } // User timers, can be edited - items(timers.value) { + items(timers.value) { timerInfo -> TimerEntry( - timerInfo = it, - true, - R.string.edit, - onButtonClick = timerOverviewActions.onEditClick - ) + timerInfo = timerInfo, + ) { + StealthButton( + text = R.string.edit, + onClick = { timerOverviewActions.onEditClick(timerInfo) } + ) + } } } @@ -103,7 +106,7 @@ fun TimerOverviewPreview() { ) TimerOverviewScreen( timerOverviewActions = TimerOverviewActions( - { flowOf(listOf()) }, + { flowOf() }, { listOf(customTimer, customTimer) }, {}), drawerActions = DrawerActions({}, {}, {}, {}, {}), diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/timer_selection/TimerSelectionScreen.kt b/app/src/main/java/be/ugent/sel/studeez/screens/timer_selection/TimerSelectionScreen.kt index 4692d68..c6d8f4e 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/timer_selection/TimerSelectionScreen.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/timer_selection/TimerSelectionScreen.kt @@ -10,13 +10,14 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import be.ugent.sel.studeez.R import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate +import be.ugent.sel.studeez.common.composable.StealthButton import be.ugent.sel.studeez.common.composable.TimerEntry -import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo -import be.ugent.sel.studeez.resources import be.ugent.sel.studeez.common.composable.drawer.DrawerActions import be.ugent.sel.studeez.common.composable.drawer.getDrawerActions import be.ugent.sel.studeez.common.composable.navbar.NavigationBarActions import be.ugent.sel.studeez.common.composable.navbar.getNavigationBarActions +import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo +import be.ugent.sel.studeez.resources import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @@ -62,13 +63,15 @@ fun TimerSelectionScreen( ) { LazyColumn(verticalArrangement = Arrangement.spacedBy(7.dp)) { // All timers - items(timers.value) { + items(timers.value) { timerInfo -> TimerEntry( - timerInfo = it, - showButton = true, - buttonName = R.string.start, - onButtonClick = timerSelectionActions.startSession - ) + timerInfo = timerInfo, + ) { + StealthButton( + text = R.string.start, + onClick = { timerSelectionActions.startSession(timerInfo) } + ) + } } } }