summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Timer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/Timer.cpp')
-rw-r--r--src/displayapp/screens/Timer.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp
index 459d5f6..1b2144c 100644
--- a/src/displayapp/screens/Timer.cpp
+++ b/src/displayapp/screens/Timer.cpp
@@ -13,7 +13,8 @@ void Timer::btnEventHandler(lv_obj_t* obj, lv_event_t event) {
void Timer::Stop() {
int32_t secondsRemaining = timerController.GetSecondsRemaining();
- if (timerController.IsOvertime()) {
+ bool ot = timerController.IsOvertime();
+ if (ot) {
minutesToSet = 0;
secondsToSet = 0;
secondsRemaining = 0;
@@ -23,6 +24,9 @@ void Timer::Stop() {
}
timerController.StopTimer();
RefreshRunning();
+ if (ot) {
+ setTimeTextColor(LV_COLOR_RED);
+ }
}
Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
@@ -75,16 +79,20 @@ void Timer::Refresh() {
}
}
+void Timer::setTimeTextColor(lv_color_t color) {
+ lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color);
+}
+
void Timer::RefreshRunning() {
if (timerController.IsRunning()) {
if (timerController.IsOvertime()) {
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
+ setTimeTextColor(LV_COLOR_RED);
} else {
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME);
+ setTimeTextColor(LV_COLOR_LIME);
}
lv_label_set_text_static(txtPlayPause, Symbols::pause);
} else {
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+ setTimeTextColor(LV_COLOR_GRAY);
lv_label_set_text_static(txtPlayPause, Symbols::play);
CreateButtons();
}