terminal watchface: remove icons and other fixes
This commit is contained in:
parent
1bfee61ef9
commit
f1c91e1ce0
|
@ -32,25 +32,15 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
|||
motionController {motionController} {
|
||||
settingsController.SetClockFace(3);
|
||||
|
||||
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryIcon, Symbols::batteryFull);
|
||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2);
|
||||
|
||||
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryPlug, Symbols::plug);
|
||||
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
batteryValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(batteryValue, true);
|
||||
lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
|
||||
|
||||
connectState = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(connectState, true);
|
||||
lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#");
|
||||
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
||||
|
||||
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0);
|
||||
|
||||
label_date = lv_label_create(lv_scr_act(), nullptr);
|
||||
|
@ -59,11 +49,11 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
|||
|
||||
label_prompt_1 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80);
|
||||
lv_label_set_text(label_prompt_1, "user@watch:~ $ now");
|
||||
lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now");
|
||||
|
||||
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
|
||||
lv_label_set_text(label_prompt_2, "user@watch:~ $");
|
||||
lv_label_set_text_static(label_prompt_2, "user@watch:~ $");
|
||||
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label_time, true);
|
||||
|
@ -74,16 +64,14 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
|||
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
||||
lv_obj_set_size(backgroundLabel, 240, 240);
|
||||
lv_obj_set_pos(backgroundLabel, 0, 0);
|
||||
lv_label_set_text(backgroundLabel, "");
|
||||
lv_label_set_text_static(backgroundLabel, "");
|
||||
|
||||
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(heartbeatValue, true);
|
||||
lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#");
|
||||
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20);
|
||||
|
||||
stepValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(stepValue, true);
|
||||
lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#");
|
||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
|
||||
|
||||
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||
|
@ -97,20 +85,12 @@ WatchFaceTerminal::~WatchFaceTerminal() {
|
|||
|
||||
void WatchFaceTerminal::Refresh() {
|
||||
powerPresent = batteryController.IsPowerPresent();
|
||||
if (powerPresent.IsUpdated()) {
|
||||
lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get()));
|
||||
}
|
||||
|
||||
batteryPercentRemaining = batteryController.PercentRemaining();
|
||||
if (batteryPercentRemaining.IsUpdated()) {
|
||||
auto batteryPercent = batteryPercentRemaining.Get();
|
||||
if (batteryPercent == 100) {
|
||||
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
|
||||
} else {
|
||||
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) {
|
||||
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%%", batteryPercentRemaining.Get());
|
||||
if (batteryController.IsPowerPresent()) {
|
||||
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
|
||||
}
|
||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
||||
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent);
|
||||
}
|
||||
|
||||
bleState = bleController.IsConnected();
|
||||
|
@ -130,9 +110,9 @@ void WatchFaceTerminal::Refresh() {
|
|||
notificationState = notificatioManager.AreNewNotificationsAvailable();
|
||||
if (notificationState.IsUpdated()) {
|
||||
if (notificationState.Get()) {
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
|
||||
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
|
||||
} else {
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,6 @@ namespace Pinetime {
|
|||
lv_obj_t* label_prompt_1;
|
||||
lv_obj_t* label_prompt_2;
|
||||
lv_obj_t* backgroundLabel;
|
||||
lv_obj_t* batteryIcon;
|
||||
lv_obj_t* batteryPlug;
|
||||
lv_obj_t* batteryValue;
|
||||
lv_obj_t* heartbeatValue;
|
||||
lv_obj_t* stepValue;
|
||||
|
|
Loading…
Reference in a new issue