From 5ddd92a66fd6862b1755eb50fba70c25206ab721 Mon Sep 17 00:00:00 2001 From: lbarraga Date: Mon, 15 May 2023 20:58:37 +0200 Subject: [PATCH] 'merge' dots --- .../FunctionalPomodoroTimer.kt | 2 +- .../BreakTimerScreenComposable.kt | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/be/ugent/sel/studeez/data/local/models/timer_functional/FunctionalPomodoroTimer.kt b/app/src/main/java/be/ugent/sel/studeez/data/local/models/timer_functional/FunctionalPomodoroTimer.kt index 765fbcd..e754963 100644 --- a/app/src/main/java/be/ugent/sel/studeez/data/local/models/timer_functional/FunctionalPomodoroTimer.kt +++ b/app/src/main/java/be/ugent/sel/studeez/data/local/models/timer_functional/FunctionalPomodoroTimer.kt @@ -6,7 +6,7 @@ class FunctionalPomodoroTimer( val repeats: Int ) : FunctionalTimer(studyTime) { - var breaksRemaining = repeats + var breaksRemaining = repeats - 1 var isInBreak = false override fun tick() { diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/session/sessionScreens/BreakTimerScreenComposable.kt b/app/src/main/java/be/ugent/sel/studeez/screens/session/sessionScreens/BreakTimerScreenComposable.kt index 093c16a..42ec4f7 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/session/sessionScreens/BreakTimerScreenComposable.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/session/sessionScreens/BreakTimerScreenComposable.kt @@ -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