diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2022-04-07 17:28:04 +0300 |
---|---|---|
committer | Riku Isokoski <riksu9000@gmail.com> | 2022-04-25 17:03:08 +0300 |
commit | b31fbb4adb0f895ff32b93fff492070e44716d54 (patch) | |
tree | 337c1fe0065f7f20738804b74e824347e87bc207 /src/displayapp/screens/WatchFacePineTimeStyle.cpp | |
parent | 54df828665b135aa5e49a2e182bad59d2d705039 (diff) |
New sharper batteryicon. Remove old unused batteryicons
Diffstat (limited to 'src/displayapp/screens/WatchFacePineTimeStyle.cpp')
-rw-r--r-- | src/displayapp/screens/WatchFacePineTimeStyle.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 28e7a6a3..ae9f5815 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -101,11 +101,14 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); // Display icons - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_label_set_text_static(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); - lv_obj_set_auto_realign(batteryIcon, true); + batteryIcon.Create(sidebar); + batteryIcon.SetColor(LV_COLOR_BLACK); + lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_MID, 0, 2); + + 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_BLACK); + lv_obj_align(plugIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); bleIcon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); @@ -340,7 +343,7 @@ bool WatchFacePineTimeStyle::OnButtonPushed() { void WatchFacePineTimeStyle::SetBatteryIcon() { auto batteryPercent = batteryPercentRemaining.Get(); - lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + batteryIcon.SetBatteryPercentage(batteryPercent); } void WatchFacePineTimeStyle::AlignIcons() { @@ -358,8 +361,11 @@ void WatchFacePineTimeStyle::Refresh() { isCharging = batteryController.IsCharging(); if (isCharging.IsUpdated()) { if (isCharging.Get()) { - 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(); } } |