diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-21 14:06:42 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-21 14:06:42 (GMT) |
| commit | 3744e655fa94cc2efece15c3196cf8b398354ca2 (patch) | |
| tree | 1040ff59e6f06fb901ba621856e28957c0b36589 /src/displayapp/screens/settings | |
| parent | 9f062635af3548425102b976e26ebbdfa998d670 (diff) | |
| parent | 8ea7d77d1b1f476c890bf04b44ad9e2c858a4d1c (diff) | |
Merge branch 'rev22-develop' into edge
Diffstat (limited to 'src/displayapp/screens/settings')
| -rw-r--r-- | src/displayapp/screens/settings/QuickSettings.cpp | 17 | ||||
| -rw-r--r-- | src/displayapp/screens/settings/SettingShakeThreshold.cpp | 8 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index d2754ec..46f2f02 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -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,15 +124,18 @@ 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) { - if (object == btn2 && event == LV_EVENT_CLICKED) { - - running = false; - app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up); - + if (object == btn2) { + if (event == LV_EVENT_CLICKED) { + running = false; + app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up); + } else if (event == LV_EVENT_LONG_PRESSED) { + running = false; + app->StartApp(Apps::FlashLightRed, DisplayApp::FullRefreshDirections::Up); + } } else if (object == btn1 && event == LV_EVENT_CLICKED) { brightness.Step(); diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index 9d40fcf..c354bdc 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -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; } |
