summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceAnalog.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-04-07 17:28:04 +0300
committerRiku Isokoski <riksu9000@gmail.com>2022-04-25 17:03:08 +0300
commitb31fbb4adb0f895ff32b93fff492070e44716d54 (patch)
tree337c1fe0065f7f20738804b74e824347e87bc207 /src/displayapp/screens/WatchFaceAnalog.cpp
parent54df828665b135aa5e49a2e182bad59d2d705039 (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 6f9dd1b6..dd5b2929 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_MAKE(0x0, 0xb0, 0x0));
- } 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();
}
}