summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/screens/Alarm.cpp19
-rw-r--r--src/displayapp/screens/Alarm.h2
2 files changed, 17 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()) {
diff --git a/src/displayapp/screens/Alarm.h b/src/displayapp/screens/Alarm.h
index abf97eba..32a14d2f 100644
--- a/src/displayapp/screens/Alarm.h
+++ b/src/displayapp/screens/Alarm.h
@@ -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;
@@ -46,6 +47,7 @@ namespace Pinetime {
void SetRecurButtonState();
void SetAlarm();
void ShowInfo();
+ void HideInfo();
void ToggleRecurrence();
void UpdateAlarmTime();
};