diff options
Diffstat (limited to 'src/displayapp/screens')
| -rw-r--r-- | src/displayapp/screens/Timer.cpp | 38 | ||||
| -rw-r--r-- | src/displayapp/screens/Timer.h | 46 |
2 files changed, 38 insertions, 46 deletions
diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index 935dbe2..459d5f6 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -11,44 +11,6 @@ void Timer::btnEventHandler(lv_obj_t* obj, lv_event_t event) { screen->OnButtonEvent(obj, event); } -void Timer::CreateButtons() { - if (btnMinutesUp != nullptr) { - return; - } - - btnMinutesUp = lv_btn_create(lv_scr_act(), nullptr); - btnMinutesUp->user_data = this; - lv_obj_set_event_cb(btnMinutesUp, btnEventHandler); - lv_obj_set_size(btnMinutesUp, 60, 40); - lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -85); - txtMUp = lv_label_create(btnMinutesUp, nullptr); - lv_label_set_text_static(txtMUp, "+"); - - btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr); - btnMinutesDown->user_data = this; - lv_obj_set_event_cb(btnMinutesDown, btnEventHandler); - lv_obj_set_size(btnMinutesDown, 60, 40); - lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +35); - txtMDown = lv_label_create(btnMinutesDown, nullptr); - lv_label_set_text_static(txtMDown, "-"); - - btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr); - btnSecondsUp->user_data = this; - lv_obj_set_event_cb(btnSecondsUp, btnEventHandler); - lv_obj_set_size(btnSecondsUp, 60, 40); - lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, -85); - txtSUp = lv_label_create(btnSecondsUp, nullptr); - lv_label_set_text_static(txtSUp, "+"); - - btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr); - btnSecondsDown->user_data = this; - lv_obj_set_event_cb(btnSecondsDown, btnEventHandler); - lv_obj_set_size(btnSecondsDown, 60, 40); - lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, +35); - txtSDown = lv_label_create(btnSecondsDown, nullptr); - lv_label_set_text_static(txtSDown, "-"); -} - void Timer::Stop() { int32_t secondsRemaining = timerController.GetSecondsRemaining(); if (timerController.IsOvertime()) { diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index cb5aeb2..dd55602 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -19,13 +19,6 @@ namespace Pinetime::Applications::Screens { void Refresh() override; void RefreshRunning(); - inline void SetDone() { - lv_label_set_text_static(time, "00:00"); - RefreshRunning(); - secondsToSet = 0; - minutesToSet = 0; - CreateButtons(); - } private: static void btnEventHandler(lv_obj_t* obj, lv_event_t event); inline void OnButtonEvent(lv_obj_t* obj, lv_event_t event) { @@ -76,7 +69,44 @@ namespace Pinetime::Applications::Screens { } } } - void CreateButtons(); + + inline void CreateButtons() { + if (btnMinutesUp != nullptr) { + return; + } + + btnMinutesUp = lv_btn_create(lv_scr_act(), nullptr); + btnMinutesUp->user_data = this; + lv_obj_set_event_cb(btnMinutesUp, btnEventHandler); + lv_obj_set_size(btnMinutesUp, 60, 40); + lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -85); + txtMUp = lv_label_create(btnMinutesUp, nullptr); + lv_label_set_text_static(txtMUp, "+"); + + btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr); + btnMinutesDown->user_data = this; + lv_obj_set_event_cb(btnMinutesDown, btnEventHandler); + lv_obj_set_size(btnMinutesDown, 60, 40); + lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +35); + txtMDown = lv_label_create(btnMinutesDown, nullptr); + lv_label_set_text_static(txtMDown, "-"); + + btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr); + btnSecondsUp->user_data = this; + lv_obj_set_event_cb(btnSecondsUp, btnEventHandler); + lv_obj_set_size(btnSecondsUp, 60, 40); + lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, -85); + txtSUp = lv_label_create(btnSecondsUp, nullptr); + lv_label_set_text_static(txtSUp, "+"); + + btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr); + btnSecondsDown->user_data = this; + lv_obj_set_event_cb(btnSecondsDown, btnEventHandler); + lv_obj_set_size(btnSecondsDown, 60, 40); + lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, +35); + txtSDown = lv_label_create(btnSecondsDown, nullptr); + lv_label_set_text_static(txtSDown, "-"); + } inline void DeleteButtons() { lv_obj_del(btnSecondsDown); btnSecondsDown = nullptr; |
