Show battery indicator when side cover hidden
This commit is contained in:
parent
603af7c372
commit
20b31fdbe5
2 changed files with 16 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ namespace Pinetime {
|
|||
Controllers::MotionController& motionController;
|
||||
|
||||
void SetBatteryLevel(uint8_t batteryPercent);
|
||||
void ToggleBatteryIndicatorColor(bool showSideCover);
|
||||
|
||||
lv_task_t* taskRefresh;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue