diff options
author | JF <JF002@users.noreply.github.com> | 2021-10-09 19:50:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 19:50:36 +0200 |
commit | 4118f97812c6335b907a2b5602dcb12ed40aa0da (patch) | |
tree | e75e3fec889a0538331ff50db8f8dd5d74ed7052 /src/displayapp/screens/Alarm.cpp | |
parent | 90fdea29b80016c6d0e6d518853c9251555ea695 (diff) | |
parent | 05f8850acf163f255d58e6224a3f9382b42e6ed4 (diff) |
Merge pull request #701 from maksalees/close-info-popup-with-back-button-in-alarm
Alarm: Close the popup with information about the time until alarm with the back button
Diffstat (limited to 'src/displayapp/screens/Alarm.cpp')
-rw-r--r-- | src/displayapp/screens/Alarm.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp index 959cb0b2..6b45a36e 100644 --- a/src/displayapp/screens/Alarm.cpp +++ b/src/displayapp/screens/Alarm.cpp @@ -120,10 +120,7 @@ void Alarm::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { return; } if (obj == btnMessage) { - lv_obj_del(txtMessage); - lv_obj_del(btnMessage); - txtMessage = nullptr; - btnMessage = nullptr; + HideInfo(); return; } // If any other button was pressed, disable the alarm @@ -174,6 +171,14 @@ void Alarm::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { } } +bool Alarm::OnButtonPushed() { + if (txtMessage != nullptr && btnMessage != nullptr) { + HideInfo(); + return true; + } + return false; +} + void Alarm::UpdateAlarmTime() { lv_label_set_text_fmt(time, "%02d:%02d", alarmHours, alarmMinutes); alarmController.SetAlarmTime(alarmHours, alarmMinutes); @@ -224,6 +229,12 @@ void Alarm::ShowInfo() { } } +void Alarm::HideInfo() { + lv_obj_del(btnMessage); + txtMessage = nullptr; + btnMessage = nullptr; +} + void Alarm::SetRecurButtonState() { using Pinetime::Controllers::AlarmController; switch (alarmController.Recurrence()) { |