diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-05-28 14:58:54 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-05-28 14:58:54 (GMT) |
| commit | 94b1b330fc1f6e941a797fedabade4e790e28bc2 (patch) | |
| tree | 0dc021eac3a5d34b3991b7557d9c6495e0a65c87 | |
| parent | 269802b450b1c6b5646d1df10abdfc5733a8b1b9 (diff) | |
further compress code for watchfaceterminal
| -rw-r--r-- | src/displayapp/screens/WatchFaceTerminal.cpp | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 8569f6c..57395b7 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -30,25 +30,6 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, settingsController {settingsController}, heartRateController {heartRateController}, motionController {motionController} { - batteryValue = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(batteryValue, true); - - connectState = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(connectState, true); - - notificationIcon = lv_label_create(lv_scr_act(), nullptr); - - label_date = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(label_date, true); - - label_prompt_1 = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now"); - - label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(label_prompt_2, "user@watch:~ $"); - - label_time = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(label_time, true); backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_click(backgroundLabel, true); @@ -57,18 +38,22 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text_static(backgroundLabel, ""); - heartbeatValue = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(heartbeatValue, true); - - stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(stepValue, true); - uint16_t y = -100; - for (auto line : lines) { + for (auto& line : lines) { + line = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(line, nullptr, LV_ALIGN_IN_LEFT_MID, 0, y); y += 20; } + lv_label_set_recolor(batteryValue, true); + lv_label_set_recolor(connectState, true); + lv_label_set_recolor(label_date, true); + lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now"); + lv_label_set_text_static(label_prompt_2, "user@watch:~ $"); + lv_label_set_recolor(label_time, true); + lv_label_set_recolor(heartbeatValue, true); + lv_label_set_recolor(stepValue, true); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); Refresh(); } |
