'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
) : FunctionalTimer(studyTime) {
var breaksRemaining = repeats
var breaksRemaining = repeats - 1
var isInBreak = false
override fun tick() {

View file

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