Alarm: Close the popup with information about the time until alarm with the back button

Previously, pressing the back button would close the alarm app anyway. Now if you press on it and the popup with information is open, it will first close and the second press will close the application
This commit is contained in:
Maxim Leshchenko 2021-09-28 22:50:09 +03:00
parent e9bb0b3cdd
commit d86ae69961
2 changed files with 12 additions and 0 deletions

View file

@ -174,6 +174,17 @@ void Alarm::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
}
}
bool Alarm::OnButtonPushed() {
if (txtMessage != nullptr && btnMessage != nullptr) {
lv_obj_del(txtMessage);
lv_obj_del(btnMessage);
txtMessage = nullptr;
btnMessage = nullptr;
return true;
}
return false;
}
void Alarm::UpdateAlarmTime() {
lv_label_set_text_fmt(time, "%02d:%02d", alarmHours, alarmMinutes);
alarmController.SetAlarmTime(alarmHours, alarmMinutes);

View file

@ -31,6 +31,7 @@ namespace Pinetime {
~Alarm() override;
void SetAlerting();
void OnButtonEvent(lv_obj_t* obj, lv_event_t event);
bool OnButtonPushed() override;
private:
bool running;