From 3915d3a344bda55aa92385729b18f3f813957e82 Mon Sep 17 00:00:00 2001 From: liamcharger Date: Sun, 31 Mar 2024 04:57:11 +1030 Subject: [PATCH] Minor improvements --- src/displayapp/screens/WatchFaceNumerals.cpp | 62 +++++++++++--------- src/displayapp/screens/WatchFaceNumerals.h | 9 +-- src/resources/resources.json | 44 +++++++------- 3 files changed, 61 insertions(+), 54 deletions(-) diff --git a/src/displayapp/screens/WatchFaceNumerals.cpp b/src/displayapp/screens/WatchFaceNumerals.cpp index 8fb217e4..28010d75 100644 --- a/src/displayapp/screens/WatchFaceNumerals.cpp +++ b/src/displayapp/screens/WatchFaceNumerals.cpp @@ -31,37 +31,43 @@ WatchFaceNumerals::WatchFaceNumerals(Controllers::DateTime& dateTimeController, notificationIcon = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); lv_obj_set_style_local_radius(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_size(notificationIcon, 18, 18); - lv_obj_align(notificationIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 2, -65); + lv_obj_set_size(notificationIcon, 12, 12); + lv_obj_align(notificationIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 6, -65); lv_obj_set_hidden(notificationIcon, true); - label_time_hour = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_time_hour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_large); - lv_obj_set_style_local_text_color(label_time_hour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_obj_align(label_time_hour, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -160, -125); + labelTimeHour = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(labelTimeHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_large); + lv_obj_set_style_local_text_color(labelTimeHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_align(labelTimeHour, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -160, -125); - label_time_minute = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_time_minute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_large); - lv_obj_set_style_local_text_color(label_time_minute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); - lv_obj_align(label_time_minute, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -160, 0); + labelTimeMinute = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(labelTimeMinute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_large); + lv_obj_set_style_local_text_color(labelTimeMinute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + lv_obj_align(labelTimeMinute, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -160, 0); - label_time_ampm = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(label_time_ampm, ""); - lv_obj_set_style_local_text_font(label_time_ampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); - lv_obj_set_style_local_text_color(label_time_ampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); - lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 2, -28); + labelTimeAMPM1 = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(labelTimeAMPM1, ""); + lv_obj_set_style_local_text_font(labelTimeAMPM1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); + lv_obj_set_style_local_text_color(labelTimeAMPM1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_align(labelTimeAMPM1, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 2, -28); - dateDay = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_label_set_text(dateDay, "--"); - lv_obj_set_style_local_text_font(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); - lv_obj_align(dateDay, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); + labelTimeAMPM2 = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(labelTimeAMPM2, ""); + lv_obj_set_style_local_text_font(labelTimeAMPM2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); + lv_obj_set_style_local_text_color(labelTimeAMPM2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_align(labelTimeAMPM2, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 2, 0); dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_label_set_text(dateDayOfWeek, "---"); lv_obj_set_style_local_text_font(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); - lv_obj_align(dateDayOfWeek, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 26); + lv_obj_align(dateDayOfWeek, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); + + dateDay = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_label_set_text(dateDay, "--"); + lv_obj_set_style_local_text_font(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small); + lv_obj_align(dateDay, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 30); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); Refresh(); @@ -100,7 +106,7 @@ void WatchFaceNumerals::Refresh() { displayedMinute = minute; if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { - char ampmChar[4] = "A\nM"; + char ampmChar[2] = "A"; if (hour == 0) { hour = 12; } else if (hour == 12) { @@ -109,13 +115,13 @@ void WatchFaceNumerals::Refresh() { hour = hour - 12; ampmChar[0] = 'P'; } - lv_label_set_text(label_time_ampm, ampmChar); - // Should be padded with blank spaces, but the space character doesn't exist in the font - lv_label_set_text_fmt(label_time_hour, "%02d", hour); - lv_label_set_text_fmt(label_time_minute, "%02d", minute); + lv_label_set_text(labelTimeAMPM1, ampmChar); + lv_label_set_text(labelTimeAMPM2, "M"); + lv_label_set_text_fmt(labelTimeHour, "%02d", hour); + lv_label_set_text_fmt(labelTimeMinute, "%02d", minute); } else { - lv_label_set_text_fmt(label_time_hour, "%02d", hour); - lv_label_set_text_fmt(label_time_minute, "%02d", minute); + lv_label_set_text_fmt(labelTimeHour, "%02d", hour); + lv_label_set_text_fmt(labelTimeMinute, "%02d", minute); } } diff --git a/src/displayapp/screens/WatchFaceNumerals.h b/src/displayapp/screens/WatchFaceNumerals.h index 7d24748d..c5711e0a 100644 --- a/src/displayapp/screens/WatchFaceNumerals.h +++ b/src/displayapp/screens/WatchFaceNumerals.h @@ -42,9 +42,10 @@ namespace Pinetime { Utility::DirtyValue notificationState {}; Utility::DirtyValue> currentDateTime {}; - lv_obj_t* label_time_hour; - lv_obj_t* label_time_minute; - lv_obj_t* label_time_ampm; + lv_obj_t* labelTimeHour; + lv_obj_t* labelTimeMinute; + lv_obj_t* labelTimeAMPM1; + lv_obj_t* labelTimeAMPM2; lv_obj_t* label_date; lv_obj_t* notificationIcon; lv_obj_t* dateDay; @@ -64,7 +65,7 @@ namespace Pinetime { template <> struct WatchFaceTraits { static constexpr WatchFace watchFace = WatchFace::Numerals; - static constexpr const char* name = "Numeral face"; + static constexpr const char* name = "Numerals"; static Screens::Screen* Create(AppControllers& controllers) { return new Screens::WatchFaceNumerals(controllers.dateTimeController, diff --git a/src/resources/resources.json b/src/resources/resources.json index 3a66f2fa..3bcea4bb 100644 --- a/src/resources/resources.json +++ b/src/resources/resources.json @@ -1,32 +1,36 @@ { "resources": [ + { + "filename": "teko.bin", + "path": "/fonts/teko.bin" + }, { "filename": "7segments_40.bin", "path": "/fonts/7segments_40.bin" }, - { - "filename": "rounded_large.bin", - "path": "/fonts/rounded_large.bin" - }, - { - "filename": "rounded_small.bin", - "path": "/fonts/rounded_small.bin" - }, - { - "filename": "bebas.bin", - "path": "/fonts/bebas.bin" - }, - { - "filename": "7segments_115.bin", - "path": "/fonts/7segments_115.bin" - }, { "filename": "lv_font_dots_40.bin", "path": "/fonts/lv_font_dots_40.bin" }, { - "filename": "teko.bin", - "path": "/fonts/teko.bin" + "filename": "7segments_115.bin", + "path": "/fonts/7segments_115.bin" + }, + { + "filename": "bebas.bin", + "path": "/fonts/bebas.bin" + }, + { + "filename": "rounded_small.bin", + "path": "/fonts/rounded_small.bin" + }, + { + "filename": "rounded_large.bin", + "path": "/fonts/rounded_large.bin" + }, + { + "filename": "pine_small.bin", + "path": "/images/pine_small.bin" }, { "filename": "navigation1.bin", @@ -35,10 +39,6 @@ { "filename": "navigation0.bin", "path": "/images/navigation0.bin" - }, - { - "filename": "pine_small.bin", - "path": "/images/pine_small.bin" } ], "obsolete_files": [