Skip to content

Commit df67194

Browse files
committed
Timer: change layout to match Alarm app
1 parent ea3fccc commit df67194

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/displayapp/screens/Alarm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ namespace Pinetime {
4747
enum class EnableButtonState { On, Off, Alerting };
4848
void SetEnableButtonState();
4949
void SetRecurButtonState();
50-
void SetAlarm();
5150
void ShowInfo();
5251
void HideInfo();
5352
void ToggleRecurrence();

src/displayapp/screens/Timer.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,32 @@ void Timer::createButtons() {
1515
btnMinutesUp = lv_btn_create(lv_scr_act(), nullptr);
1616
btnMinutesUp->user_data = this;
1717
lv_obj_set_event_cb(btnMinutesUp, btnEventHandler);
18-
lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -80);
19-
lv_obj_set_height(btnMinutesUp, 40);
20-
lv_obj_set_width(btnMinutesUp, 60);
18+
lv_obj_set_size(btnMinutesUp, 60, 40);
19+
lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -85);
2120
txtMUp = lv_label_create(btnMinutesUp, nullptr);
2221
lv_label_set_text(txtMUp, "+");
2322

2423
btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr);
2524
btnMinutesDown->user_data = this;
2625
lv_obj_set_event_cb(btnMinutesDown, btnEventHandler);
27-
lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +40);
28-
lv_obj_set_height(btnMinutesDown, 40);
29-
lv_obj_set_width(btnMinutesDown, 60);
26+
lv_obj_set_size(btnMinutesDown, 60, 40);
27+
lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +35);
3028
txtMDown = lv_label_create(btnMinutesDown, nullptr);
3129
lv_label_set_text(txtMDown, "-");
3230

3331
btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr);
3432
btnSecondsUp->user_data = this;
3533
lv_obj_set_event_cb(btnSecondsUp, btnEventHandler);
36-
lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 10, -80);
37-
lv_obj_set_height(btnSecondsUp, 40);
38-
lv_obj_set_width(btnSecondsUp, 60);
34+
lv_obj_set_size(btnSecondsUp, 60, 40);
35+
lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, -85);
3936
txtSUp = lv_label_create(btnSecondsUp, nullptr);
4037
lv_label_set_text(txtSUp, "+");
4138

4239
btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr);
4340
btnSecondsDown->user_data = this;
4441
lv_obj_set_event_cb(btnSecondsDown, btnEventHandler);
45-
lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 10, +40);
46-
lv_obj_set_height(btnSecondsDown, 40);
47-
lv_obj_set_width(btnSecondsDown, 60);
42+
lv_obj_set_size(btnSecondsDown, 60, 40);
43+
lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, +35);
4844
txtSDown = lv_label_create(btnSecondsDown, nullptr);
4945
lv_label_set_text(txtSDown, "-");
5046
}
@@ -85,13 +81,13 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
8581

8682
lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60);
8783

88-
lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
84+
lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -25);
8985

9086
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
9187
btnPlayPause->user_data = this;
9288
lv_obj_set_event_cb(btnPlayPause, btnEventHandler);
93-
lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, -10);
94-
lv_obj_set_height(btnPlayPause, 40);
89+
lv_obj_set_size(btnPlayPause, 115, 50);
90+
lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
9591
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
9692
if (timerController.IsRunning()) {
9793
lv_label_set_text(txtPlayPause, overtime ? Symbols::stop : Symbols::pause);
@@ -122,6 +118,9 @@ void Timer::Refresh() {
122118
stop();
123119
return;
124120
}
121+
if (seconds == 10) {
122+
timerController.StopAlerting();
123+
}
125124
}
126125
lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60);
127126
}

0 commit comments

Comments
 (0)