Fix for passkey screen scramble

When a passkey is displayed, screen on or off, and another
passkey is displayed the screen may become scrambled. Fix
the issue by insuring the whole screen is drawn every time.
This commit is contained in:
James A. Jerkins 2021-11-01 15:12:25 -05:00 committed by JF
parent 62dbcbfc95
commit 1e4130a9cf
3 changed files with 17 additions and 9 deletions

View file

@ -215,6 +215,9 @@ void DisplayApp::Refresh() {
} else {
LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None);
}
case Messages::ShowPairingKey:
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
break;
case Messages::TouchEvent: {
if (state != States::Running) {
break;
@ -289,9 +292,6 @@ void DisplayApp::Refresh() {
// Added to remove warning
// What should happen here?
break;
case Messages::ShowPairingKey:
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
break;
}
}

View file

@ -4,11 +4,18 @@
using namespace Pinetime::Applications::Screens;
PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) {
lpasskey = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
lv_obj_set_style_local_text_font(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(lpasskey, "%06u", key);
lv_obj_align(lpasskey, nullptr, LV_ALIGN_CENTER, 0, -20);
passkeyLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(passkeyLabel, "%06u", key);
lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20);
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
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, "");
}
PassKey::~PassKey() {

View file

@ -13,7 +13,8 @@ namespace Pinetime {
~PassKey() override;
private:
lv_obj_t* lpasskey;
lv_obj_t* passkeyLabel;
lv_obj_t* backgroundLabel;
};
}
}