summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFacePineTimeStyle.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/WatchFacePineTimeStyle.cpp
parentfbfb8fa4a2ca9274c73f2ba2e6cec4b8fc9e8ad4 (diff)
New sharper batteryicon. Remove old unused batteryicons
Diffstat (limited to 'src/displayapp/screens/WatchFacePineTimeStyle.cpp')
-rw-r--r--src/displayapp/screens/WatchFacePineTimeStyle.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp
index dde07e8..b9afcc8 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, nullptr, 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();
}
}