summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceInfineat.cpp
diff options
context:
space:
mode:
authorDiego Miguel <dmlls@diegomiguel.me>2022-05-21 14:04:49 +0200
committerDiego Miguel <dmlls@diegomiguel.me>2022-06-11 16:57:24 +0200
commit20b31fdbe5667930ad9ec1fae5dd13010c783a47 (patch)
treefe709ca25eed469c9b17b38bf06446f8d0018c08 /src/displayapp/screens/WatchFaceInfineat.cpp
parent603af7c372bbd1c36e72ba9ef0e80c1ad8b1a438 (diff)
Show battery indicator when side cover hidden
Diffstat (limited to 'src/displayapp/screens/WatchFaceInfineat.cpp')
-rw-r--r--src/displayapp/screens/WatchFaceInfineat.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp
index 215a7db6..d4b7c446 100644
--- a/src/displayapp/screens/WatchFaceInfineat.cpp
+++ b/src/displayapp/screens/WatchFaceInfineat.cpp
@@ -153,7 +153,7 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
lv_obj_move_foreground(lineBattery);
if(!settingsController.GetInfineatShowSideCover()) {
- lv_obj_set_hidden(logoPine, true);
+ ToggleBatteryIndicatorColor(false);
lv_obj_set_hidden(line0, true);
lv_obj_set_hidden(line1, true);
lv_obj_set_hidden(line2, true);
@@ -163,7 +163,6 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
lv_obj_set_hidden(line6, true);
lv_obj_set_hidden(line7, true);
lv_obj_set_hidden(line8, true);
- lv_obj_set_hidden(lineBattery, true);
}
notificationIcon = lv_obj_create(lv_scr_act(), nullptr);
@@ -338,7 +337,7 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
}
if (object == btnToggleCover) {
settingsController.SetInfineatShowSideCover(!showSideCover);
- lv_obj_set_hidden(logoPine, showSideCover);
+ ToggleBatteryIndicatorColor(!showSideCover);
lv_obj_set_hidden(line0, showSideCover);
lv_obj_set_hidden(line1, showSideCover);
lv_obj_set_hidden(line2, showSideCover);
@@ -348,7 +347,6 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
lv_obj_set_hidden(line6, showSideCover);
lv_obj_set_hidden(line7, showSideCover);
lv_obj_set_hidden(line8, showSideCover);
- lv_obj_set_hidden(lineBattery, showSideCover);
lv_obj_set_hidden(btnNextColor, showSideCover);
lv_obj_set_hidden(btnPrevColor, showSideCover);
const char* labelToggle = showSideCover ? "OFF" : "ON";
@@ -520,3 +518,16 @@ void WatchFaceInfineat::SetBatteryLevel(uint8_t batteryPercent) {
lineBatteryPoints[1] = {27, static_cast<lv_coord_t>(105 + 32*(100-batteryPercent)/100)};
lv_line_set_points(lineBattery, lineBatteryPoints, 2);
}
+
+void WatchFaceInfineat::ToggleBatteryIndicatorColor(bool showSideCover) {
+ if (!showSideCover) { // make indicator white
+ lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100);
+ lv_obj_set_style_local_image_recolor(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_style_set_line_color(&lineBatteryStyle, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ } else {
+ lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
+ lv_style_set_line_color(&lineBatteryStyle, LV_STATE_DEFAULT,
+ lv_color_hex(infineatColors.orange[settingsController.GetInfineatColorIndex()*nLines + 4]));
+ }
+ lv_obj_add_style(lineBattery, LV_LINE_PART_MAIN, &lineBatteryStyle);
+}