summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceAnalog.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-04-07 14:28:04 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-06-06 05:32:21 (GMT)
commitfab003528965668e2855491b36b5ba553c6a52f5 (patch)
tree03cb04e9813b381ef7626970d549b58191f379d4 /src/displayapp/screens/WatchFaceAnalog.cpp
parentfbfb8fa4a2ca9274c73f2ba2e6cec4b8fc9e8ad4 (diff)
New sharper batteryicon. Remove old unused batteryicons
Diffstat (limited to 'src/displayapp/screens/WatchFaceAnalog.cpp')
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 4cfc969..c1df675 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -66,10 +66,13 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
lv_img_set_src(bg_clock_img, &bg_clock);
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
- batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(batteryIcon, Symbols::batteryHalf);
- lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
- lv_obj_set_auto_realign(batteryIcon, true);
+ batteryIcon.Create(lv_scr_act());
+ lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
+
+ plugIcon = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(plugIcon, Symbols::plug);
+ lv_obj_set_style_local_text_color(plugIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
+ lv_obj_align(plugIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
notificationIcon = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
@@ -121,7 +124,8 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
- UpdateClock();
+
+ Refresh();
}
WatchFaceAnalog::~WatchFaceAnalog() {
@@ -180,21 +184,18 @@ void WatchFaceAnalog::UpdateClock() {
void WatchFaceAnalog::SetBatteryIcon() {
auto batteryPercent = batteryPercentRemaining.Get();
- if (batteryPercent == 100) {
- lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
- } else {
- lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
- }
- lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
+ batteryIcon.SetBatteryPercentage(batteryPercent);
}
void WatchFaceAnalog::Refresh() {
isCharging = batteryController.IsCharging();
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
- lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
- lv_label_set_text_static(batteryIcon, Symbols::plug);
+ lv_obj_set_hidden(batteryIcon.GetObject(), true);
+ lv_obj_set_hidden(plugIcon, false);
} else {
+ lv_obj_set_hidden(batteryIcon.GetObject(), false);
+ lv_obj_set_hidden(plugIcon, true);
SetBatteryIcon();
}
}