1
0
Fork 0

Replace lv_label_set_text where possible

This commit is contained in:
Riku Isokoski 2022-03-20 16:47:25 +02:00
parent ff73f67d6f
commit 68a7016080
22 changed files with 98 additions and 104 deletions

View file

@ -303,7 +303,7 @@ void Alarm::ShowInfo() {
lv_label_set_text_fmt(
txtMessage, "Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm);
} else {
lv_label_set_text(txtMessage, "Alarm\nis not\nset.");
lv_label_set_text_static(txtMessage, "Alarm\nis not\nset.");
}
}
@ -317,13 +317,13 @@ void Alarm::SetRecurButtonState() {
using Pinetime::Controllers::AlarmController;
switch (alarmController.Recurrence()) {
case AlarmController::RecurType::None:
lv_label_set_text(txtRecur, "ONCE");
lv_label_set_text_static(txtRecur, "ONCE");
break;
case AlarmController::RecurType::Daily:
lv_label_set_text(txtRecur, "DAILY");
lv_label_set_text_static(txtRecur, "DAILY");
break;
case AlarmController::RecurType::Weekdays:
lv_label_set_text(txtRecur, "MON-FRI");
lv_label_set_text_static(txtRecur, "MON-FRI");
}
}

View file

@ -15,7 +15,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime
lv_label_set_text_static(backgroundLabel, "");
titleLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(titleLabel, "Firmware update");
lv_label_set_text_static(titleLabel, "Firmware update");
lv_obj_set_auto_realign(titleLabel, true);
lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50);
@ -27,7 +27,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime
lv_bar_set_value(bar1, 0, LV_ANIM_OFF);
percentLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(percentLabel, "Waiting...");
lv_label_set_text_static(percentLabel, "Waiting...");
lv_obj_set_auto_realign(percentLabel, true);
lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
@ -81,20 +81,19 @@ void FirmwareUpdate::DisplayProgression() const {
float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f;
float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f;
int16_t pc = (current / total) * 100.0f;
sprintf(percentStr, "%d %%", pc);
lv_label_set_text(percentLabel, percentStr);
lv_label_set_text_fmt(percentLabel, "%d %%", pc);
lv_bar_set_value(bar1, pc, LV_ANIM_OFF);
}
void FirmwareUpdate::UpdateValidated() {
lv_label_set_recolor(percentLabel, true);
lv_label_set_text(percentLabel, "#00ff00 Image Ok!#");
lv_label_set_text_static(percentLabel, "#00ff00 Image Ok!#");
}
void FirmwareUpdate::UpdateError() {
lv_label_set_recolor(percentLabel, true);
lv_label_set_text(percentLabel, "#ff0000 Error!#");
lv_label_set_text_static(percentLabel, "#ff0000 Error!#");
startTime = xTaskGetTickCount();
}

View file

@ -24,7 +24,6 @@ namespace Pinetime {
lv_obj_t* bar1;
lv_obj_t* percentLabel;
lv_obj_t* titleLabel;
mutable char percentStr[10];
States state = States::Idle;

View file

@ -33,9 +33,9 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
lv_obj_set_width(labelIsValidated, 240);
if (validator.IsValidated())
lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
else {
lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
lv_label_set_text_static(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
buttonValidate->user_data = this;

View file

@ -45,7 +45,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundAction, 240, 240);
lv_obj_set_pos(backgroundAction, 0, 0);
lv_label_set_text(backgroundAction, "");
lv_label_set_text_static(backgroundAction, "");
lv_obj_set_click(backgroundAction, true);
backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, event_handler);

View file

@ -41,16 +41,16 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
else
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(label_hr, "000");
lv_label_set_text_static(label_hr, "000");
lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
label_bpm = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(label_bpm, "Heart rate BPM");
lv_label_set_text_static(label_bpm, "Heart rate BPM");
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
label_status = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
lv_label_set_text_static(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
@ -81,13 +81,13 @@ void HeartRate::Refresh() {
case Controllers::HeartRateController::States::NoTouch:
case Controllers::HeartRateController::States::NotEnoughData:
// case Controllers::HeartRateController::States::Stopped:
lv_label_set_text(label_hr, "000");
lv_label_set_text_static(label_hr, "000");
break;
default:
lv_label_set_text_fmt(label_hr, "%03d", heartRateController.HeartRate());
}
lv_label_set_text(label_status, ToString(state));
lv_label_set_text_static(label_status, ToString(state));
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
}
@ -109,7 +109,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
void HeartRate::UpdateStartStopButton(bool isRunning) {
if (isRunning)
lv_label_set_text(label_startStop, "Stop");
lv_label_set_text_static(label_startStop, "Stop");
else
lv_label_set_text(label_startStop, "Start");
lv_label_set_text_static(label_startStop, "Start");
}

View file

@ -35,7 +35,7 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_label_set_text(labelStep, "Steps ---");
lv_label_set_text_static(labelStep, "Steps ---");
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}

View file

@ -62,7 +62,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnVolDown, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_add_style(btnVolDown, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnVolDown, nullptr);
lv_label_set_text(label, Symbols::volumDown);
lv_label_set_text_static(label, Symbols::volumDown);
lv_obj_set_hidden(btnVolDown, true);
btnVolUp = lv_btn_create(lv_scr_act(), nullptr);
@ -72,7 +72,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnVolUp, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(btnVolUp, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnVolUp, nullptr);
lv_label_set_text(label, Symbols::volumUp);
lv_label_set_text_static(label, Symbols::volumUp);
lv_obj_set_hidden(btnVolUp, true);
btnPrev = lv_btn_create(lv_scr_act(), nullptr);
@ -82,7 +82,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnPrev, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_add_style(btnPrev, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnPrev, nullptr);
lv_label_set_text(label, Symbols::stepBackward);
lv_label_set_text_static(label, Symbols::stepBackward);
btnNext = lv_btn_create(lv_scr_act(), nullptr);
btnNext->user_data = this;
@ -91,7 +91,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnNext, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(btnNext, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnNext, nullptr);
lv_label_set_text(label, Symbols::stepForward);
lv_label_set_text_static(label, Symbols::stepForward);
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
@ -100,12 +100,12 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnPlayPause, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_add_style(btnPlayPause, LV_STATE_DEFAULT, &btn_style);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtPlayPause, Symbols::play);
txtTrackDuration = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL);
lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20);
lv_label_set_text(txtTrackDuration, "--:--/--:--");
lv_label_set_text_static(txtTrackDuration, "--:--/--:--");
lv_label_set_align(txtTrackDuration, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtTrackDuration, LV_HOR_RES);
@ -117,7 +117,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtArtist, LV_HOR_RES - 12);
lv_label_set_text(txtArtist, "Artist Name");
lv_label_set_text_static(txtArtist, "Artist Name");
txtTrack = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC);
@ -125,7 +125,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtTrack, LV_HOR_RES - 12);
lv_label_set_text(txtTrack, "This is a very long getTrack name");
lv_label_set_text_static(txtTrack, "This is a very long getTrack name");
/** Init animation */
imgDisc = lv_img_create(lv_scr_act(), nullptr);
@ -187,7 +187,7 @@ void Music::Refresh() {
}
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
lv_label_set_text(txtPlayPause, Symbols::pause);
lv_label_set_text_static(txtPlayPause, Symbols::pause);
if (xTaskGetTickCount() - 1024 >= lastIncrement) {
if (frameB) {
@ -211,31 +211,27 @@ void Music::Refresh() {
UpdateLength();
}
} else {
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtPlayPause, Symbols::play);
}
}
void Music::UpdateLength() {
if (totalLength > (99 * 60 * 60)) {
lv_label_set_text(txtTrackDuration, "Inf/Inf");
lv_label_set_text_static(txtTrackDuration, "Inf/Inf");
} else if (totalLength > (99 * 60)) {
char timer[12];
sprintf(timer,
"%02d:%02d/%02d:%02d",
(currentLength / (60 * 60)) % 100,
((currentLength % (60 * 60)) / 60) % 100,
(totalLength / (60 * 60)) % 100,
((totalLength % (60 * 60)) / 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
lv_label_set_text_fmt(txtTrackDuration,
"%02d:%02d/%02d:%02d",
(currentLength / (60 * 60)) % 100,
((currentLength % (60 * 60)) / 60) % 100,
(totalLength / (60 * 60)) % 100,
((totalLength % (60 * 60)) / 60) % 100);
} else {
char timer[12];
sprintf(timer,
"%02d:%02d/%02d:%02d",
(currentLength / 60) % 100,
(currentLength % 60) % 100,
(totalLength / 60) % 100,
(totalLength % 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
lv_label_set_text_fmt(txtTrackDuration,
"%02d:%02d/%02d:%02d",
(currentLength / 60) % 100,
(currentLength % 60) % 100,
(totalLength / 60) % 100,
(totalLength % 60) % 100);
}
}

View file

@ -134,13 +134,13 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro
imgFlag = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80);
lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
lv_label_set_text(imgFlag, iconForName("flag"));
lv_label_set_text_static(imgFlag, iconForName("flag"));
lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60);
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK);
lv_obj_set_width(txtNarrative, LV_HOR_RES);
lv_label_set_text(txtNarrative, "Navigation");
lv_label_set_text_static(txtNarrative, "Navigation");
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 10);
@ -148,7 +148,7 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro
lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_BREAK);
lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_obj_set_width(txtManDist, LV_HOR_RES);
lv_label_set_text(txtManDist, "--M");
lv_label_set_text_static(txtManDist, "--M");
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
@ -173,7 +173,7 @@ Navigation::~Navigation() {
void Navigation::Refresh() {
if (flag != navService.getFlag()) {
flag = navService.getFlag();
lv_label_set_text(imgFlag, iconForName(flag));
lv_label_set_text_static(imgFlag, iconForName(flag));
}
if (narrative != navService.getNarrative()) {

View file

@ -229,7 +229,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK);
lv_obj_set_width(alert_subject, LV_HOR_RES - 20);
lv_label_set_text(alert_subject, "Incoming call from");
lv_label_set_text_static(alert_subject, "Incoming call from");
lv_obj_t* alert_caller = lv_label_create(container1, nullptr);
lv_obj_align(alert_caller, alert_subject, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
@ -243,7 +243,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_accept, 76, 76);
lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
label_accept = lv_label_create(bt_accept, nullptr);
lv_label_set_text(label_accept, Symbols::phone);
lv_label_set_text_static(label_accept, Symbols::phone);
lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
bt_reject = lv_btn_create(lv_scr_act(), nullptr);
@ -252,7 +252,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_reject, 76, 76);
lv_obj_align(bt_reject, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
label_reject = lv_label_create(bt_reject, nullptr);
lv_label_set_text(label_reject, Symbols::phoneSlash);
lv_label_set_text_static(label_reject, Symbols::phoneSlash);
lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
bt_mute = lv_btn_create(lv_scr_act(), nullptr);
@ -261,7 +261,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_mute, 76, 76);
lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
label_mute = lv_label_create(bt_mute, nullptr);
lv_label_set_text(label_mute, Symbols::volumMute);
lv_label_set_text_static(label_mute, Symbols::volumMute);
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
} break;
}
@ -270,7 +270,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
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, "");
}
void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_t event) {

View file

@ -17,7 +17,7 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li
points = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text(points, "0000");
lv_label_set_text_static(points, "0000");
lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10);
paddle = lv_obj_create(lv_scr_act(), nullptr);

View file

@ -15,7 +15,7 @@ PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen
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, "");
}
PassKey::~PassKey() {

View file

@ -61,7 +61,7 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
lv_obj_set_width(resetBtn, 115);
lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
resetButtonLabel = lv_label_create(resetBtn, nullptr);
lv_label_set_text(resetButtonLabel, "Reset");
lv_label_set_text_static(resetButtonLabel, "Reset");
currentTripSteps = motionController.GetTripSteps();

View file

@ -55,13 +55,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(time, "00:00");
lv_label_set_text_static(time, "00:00");
lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45);
msecTime = lv_label_create(lv_scr_act(), nullptr);
// lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(msecTime, "00");
lv_label_set_text_static(msecTime, "00");
lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 3);
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
@ -71,7 +71,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
lv_obj_set_width(btnPlayPause, 115);
lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtPlayPause, Symbols::play);
btnStopLap = lv_btn_create(lv_scr_act(), nullptr);
btnStopLap->user_data = this;
@ -82,7 +82,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808));
txtStopLap = lv_label_create(btnStopLap, nullptr);
lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888));
lv_label_set_text(txtStopLap, Symbols::stop);
lv_label_set_text_static(txtStopLap, Symbols::stop);
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
lv_obj_set_state(txtStopLap, LV_STATE_DISABLED);
@ -90,13 +90,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
// lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30);
lv_label_set_text(lapOneText, "");
lv_label_set_text_static(lapOneText, "");
lapTwoText = lv_label_create(lv_scr_act(), nullptr);
// lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55);
lv_label_set_text(lapTwoText, "");
lv_label_set_text_static(lapTwoText, "");
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}
@ -113,11 +113,11 @@ void StopWatch::reset() {
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(time, "00:00");
lv_label_set_text(msecTime, "00");
lv_label_set_text_static(time, "00:00");
lv_label_set_text_static(msecTime, "00");
lv_label_set_text(lapOneText, "");
lv_label_set_text(lapTwoText, "");
lv_label_set_text_static(lapOneText, "");
lv_label_set_text_static(lapTwoText, "");
lapBuffer.clearBuffer();
lapNr = 0;
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
@ -129,8 +129,8 @@ void StopWatch::start() {
lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_label_set_text(txtPlayPause, Symbols::pause);
lv_label_set_text(txtStopLap, Symbols::lapsFlag);
lv_label_set_text_static(txtPlayPause, Symbols::pause);
lv_label_set_text_static(txtStopLap, Symbols::lapsFlag);
startTime = xTaskGetTickCount();
currentState = States::Running;
systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
@ -141,8 +141,8 @@ void StopWatch::pause() {
// Store the current time elapsed in cache
oldTimeElapsed += timeElapsed;
currentState = States::Halted;
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text(txtStopLap, Symbols::stop);
lv_label_set_text_static(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtStopLap, Symbols::stop);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);

View file

@ -39,7 +39,7 @@ Tile::Tile(uint8_t screenID,
// Battery
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0);
if (numScreens > 1) {
@ -120,7 +120,7 @@ Tile::~Tile() {
void Tile::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {

View file

@ -18,7 +18,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnMinutesUp, 40);
lv_obj_set_width(btnMinutesUp, 60);
txtMUp = lv_label_create(btnMinutesUp, nullptr);
lv_label_set_text(txtMUp, "+");
lv_label_set_text_static(txtMUp, "+");
btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr);
btnMinutesDown->user_data = this;
@ -27,7 +27,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnMinutesDown, 40);
lv_obj_set_width(btnMinutesDown, 60);
txtMDown = lv_label_create(btnMinutesDown, nullptr);
lv_label_set_text(txtMDown, "-");
lv_label_set_text_static(txtMDown, "-");
btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr);
btnSecondsUp->user_data = this;
@ -36,7 +36,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnSecondsUp, 40);
lv_obj_set_width(btnSecondsUp, 60);
txtSUp = lv_label_create(btnSecondsUp, nullptr);
lv_label_set_text(txtSUp, "+");
lv_label_set_text_static(txtSUp, "+");
btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr);
btnSecondsDown->user_data = this;
@ -45,7 +45,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnSecondsDown, 40);
lv_obj_set_width(btnSecondsDown, 60);
txtSDown = lv_label_create(btnSecondsDown, nullptr);
lv_label_set_text(txtSDown, "-");
lv_label_set_text_static(txtSDown, "-");
}
Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
@ -55,7 +55,7 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
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, "");
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
@ -73,9 +73,9 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
lv_obj_set_height(btnPlayPause, 40);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
if (timerController.IsRunning()) {
lv_label_set_text(txtPlayPause, Symbols::pause);
lv_label_set_text_static(txtPlayPause, Symbols::pause);
} else {
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtPlayPause, Symbols::play);
CreateButtons();
}
@ -98,7 +98,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
if (obj == btnPlayPause) {
if (timerController.IsRunning()) {
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(txtPlayPause, Symbols::play);
uint32_t seconds = timerController.GetTimeRemaining() / 1000;
minutesToSet = seconds / 60;
secondsToSet = seconds % 60;
@ -106,7 +106,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
CreateButtons();
} else if (secondsToSet + minutesToSet > 0) {
lv_label_set_text(txtPlayPause, Symbols::pause);
lv_label_set_text_static(txtPlayPause, Symbols::pause);
timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000);
lv_obj_del(btnSecondsDown);
@ -158,8 +158,8 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
}
void Timer::SetDone() {
lv_label_set_text(time, "00:00");
lv_label_set_text(txtPlayPause, Symbols::play);
lv_label_set_text_static(time, "00:00");
lv_label_set_text_static(txtPlayPause, Symbols::play);
secondsToSet = 0;
minutesToSet = 0;
CreateButtons();

View file

@ -90,7 +90,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(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, "");
}
Twos::~Twos() {

View file

@ -67,13 +67,13 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, Symbols::batteryHalf);
lv_label_set_text_static(batteryIcon, Symbols::batteryHalf);
lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_set_auto_realign(batteryIcon, true);
notificationIcon = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Date - Day / Week day
@ -185,7 +185,7 @@ void WatchFaceAnalog::SetBatteryIcon() {
} else {
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
}
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
void WatchFaceAnalog::Refresh() {
@ -193,7 +193,7 @@ void WatchFaceAnalog::Refresh() {
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
lv_label_set_text(batteryIcon, Symbols::plug);
lv_label_set_text_static(batteryIcon, Symbols::plug);
} else {
SetBatteryIcon();
}
@ -208,7 +208,7 @@ void WatchFaceAnalog::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
}
currentDateTime = dateTimeController.CurrentDateTime();

View file

@ -121,7 +121,7 @@ void WatchFaceDigital::Refresh() {
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
}
lv_obj_realign(batteryIcon);
lv_obj_realign(batteryPlug);

View file

@ -373,7 +373,7 @@ void WatchFacePineTimeStyle::Refresh() {
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
AlignIcons();
}
@ -424,10 +424,10 @@ void WatchFacePineTimeStyle::Refresh() {
}
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
lv_label_set_text_fmt(dateDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString());
lv_label_set_text_static(dateDayOfWeek, dateTimeController.DayOfWeekShortToString());
lv_label_set_text_fmt(dateDay, "%d", day);
lv_obj_realign(dateDay);
lv_label_set_text_fmt(dateMonth, "%s", dateTimeController.MonthShortToString());
lv_label_set_text_static(dateMonth, dateTimeController.MonthShortToString());
currentYear = year;
currentMonth = month;

View file

@ -40,7 +40,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
static constexpr uint8_t barHeight = 20 + innerDistance;
@ -124,7 +124,7 @@ QuickSettings::~QuickSettings() {
void QuickSettings::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {

View file

@ -57,7 +57,7 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app,
lv_obj_align(calButton, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_btn_set_checkable(calButton, true);
calLabel = lv_label_create(calButton, NULL);
lv_label_set_text(calLabel, "Calibrate");
lv_label_set_text_static(calLabel, "Calibrate");
lv_arc_set_value(positionArc, settingsController.GetShakeThreshold());
@ -91,7 +91,7 @@ void SettingShakeThreshold::Refresh() {
calibrating = 2;
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED);
lv_label_set_text(calLabel, "Shake!!");
lv_label_set_text_static(calLabel, "Shake!");
}
}
if (calibrating == 2) {
@ -121,14 +121,14 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) {
lv_arc_set_value(positionArc, 0);
calibrating = 1;
vCalTime = xTaskGetTickCount();
lv_label_set_text(calLabel, "Ready!");
lv_label_set_text_static(calLabel, "Ready!");
lv_obj_set_click(positionArc, false);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN);
} else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) {
calibrating = 0;
lv_obj_set_click(positionArc, true);
lv_label_set_text(calLabel, "Calibrate");
lv_label_set_text_static(calLabel, "Calibrate");
}
break;
}