'merge' dots

This commit is contained in:
lbarraga 2023-05-15 20:58:37 +02:00
parent 6554a92f83
commit 5ddd92a66f
2 changed files with 13 additions and 7 deletions

View file

@ -6,7 +6,7 @@ class FunctionalPomodoroTimer(
val repeats: Int val repeats: Int
) : FunctionalTimer(studyTime) { ) : FunctionalTimer(studyTime) {
var breaksRemaining = repeats var breaksRemaining = repeats - 1
var isInBreak = false var isInBreak = false
override fun tick() { override fun tick() {

View file

@ -38,12 +38,18 @@ private fun Dots(pomodoroTimer: FunctionalPomodoroTimer): Int {
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center, horizontalArrangement = Arrangement.Center,
) { ) {
repeat(pomodoroTimer.repeats - pomodoroTimer.breaksRemaining) { if (pomodoroTimer.hasEnded()) {
Dot(color = Color.DarkGray) repeat(pomodoroTimer.repeats) {
} Dot(Color.Green)
if (!pomodoroTimer.isInBreak) Dot(Color.Green) else Dot(Color.DarkGray) }
repeat(pomodoroTimer.breaksRemaining - 1) { } else {
Dot(color = Color.Gray) repeat(pomodoroTimer.repeats - pomodoroTimer.breaksRemaining - 1) {
Dot(color = Color.DarkGray)
}
if (!pomodoroTimer.isInBreak) Dot(Color.Green) else Dot(Color.DarkGray)
repeat(pomodoroTimer.breaksRemaining) {
Dot(color = Color.Gray)
}
} }
} }
return pomodoroTimer.breaksRemaining return pomodoroTimer.breaksRemaining