Dots now returns an int

This commit is contained in:
lbarraga 2023-05-15 16:30:13 +02:00
parent 492775565c
commit b614f7d530
4 changed files with 20 additions and 13 deletions

View file

@ -3,6 +3,7 @@ package be.ugent.sel.studeez.screens.session.sessionScreens.composables
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -18,18 +19,18 @@ import be.ugent.sel.studeez.screens.session.SessionActions
fun BreakSessionScreenComposable( fun BreakSessionScreenComposable(
open: (String) -> Unit, open: (String) -> Unit,
sessionActions: SessionActions, sessionActions: SessionActions,
pomodoroTimer: FunctionalPomodoroTimer pomodoroTimer: FunctionalPomodoroTimer,
) { ) {
SessionScreen( SessionScreen(
open = open, open = open,
sessionActions = sessionActions, sessionActions = sessionActions,
midSection = { Dots(pomodoroTimer) }, midSection = { Dots(pomodoroTimer = pomodoroTimer) },
motivationString = { motivationString(pomodoroTimer = pomodoroTimer) } motivationString = { motivationString (pomodoroTimer = pomodoroTimer) }
) )
} }
@Composable @Composable
private fun Dots(pomodoroTimer: FunctionalPomodoroTimer) { private fun Dots(pomodoroTimer: FunctionalPomodoroTimer): Int {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
@ -43,6 +44,7 @@ private fun Dots(pomodoroTimer: FunctionalPomodoroTimer) {
Dot(color = Color.Gray) Dot(color = Color.Gray)
} }
} }
return pomodoroTimer.breaksRemaining
} }
@Composable @Composable
@ -65,9 +67,10 @@ private fun motivationString(pomodoroTimer: FunctionalPomodoroTimer): String {
return resources().getString(R.string.state_done) return resources().getString(R.string.state_done)
} }
return resources().getQuantityString( return resources().getString(R.string.state_focus)
R.plurals.state_focus_remaining, }
pomodoroTimer.breaksRemaining,
pomodoroTimer.breaksRemaining @Composable
) private fun test(pomodoroTimer: FunctionalPomodoroTimer): String {
return pomodoroTimer.breaksRemaining.toString()
} }

View file

@ -0,0 +1,4 @@
package be.ugent.sel.studeez.screens.session.sessionScreens.composables
class GetSessionScreenComposable {
}

View file

@ -23,7 +23,7 @@ import be.ugent.sel.studeez.screens.session.SessionActions
fun SessionScreen( fun SessionScreen(
open: (String) -> Unit, open: (String) -> Unit,
sessionActions: SessionActions, sessionActions: SessionActions,
midSection: @Composable () -> Unit = {}, midSection: @Composable () -> Int = {0},
motivationString: @Composable () -> String, motivationString: @Composable () -> String,
) { ) {
@ -33,7 +33,7 @@ fun SessionScreen(
Timer( Timer(
sessionActions = sessionActions, sessionActions = sessionActions,
motivationString = motivationString, motivationString = motivationString,
midSection = midSection MidSection = midSection
) )
Box( Box(
contentAlignment = Alignment.Center, modifier = Modifier contentAlignment = Alignment.Center, modifier = Modifier

View file

@ -24,7 +24,7 @@ import kotlin.time.Duration.Companion.seconds
fun Timer( fun Timer(
sessionActions: SessionActions, sessionActions: SessionActions,
motivationString: @Composable () -> String, motivationString: @Composable () -> String,
midSection: @Composable () -> Unit MidSection: @Composable () -> Int
) { ) {
var tikker by remember { mutableStateOf(false) } var tikker by remember { mutableStateOf(false) }
LaunchedEffect(tikker) { LaunchedEffect(tikker) {
@ -39,7 +39,7 @@ fun Timer(
TimerClock(hms) TimerClock(hms)
MotivationText(text = motivationString()) MotivationText(text = motivationString())
MidSection()
Box( Box(
contentAlignment = Alignment.Center, modifier = Modifier contentAlignment = Alignment.Center, modifier = Modifier