summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alarm-app/inc/Alert/AlertView.h3
-rw-r--r--alarm-app/src/Alert/AlertView.cpp12
2 files changed, 10 insertions, 5 deletions
diff --git a/alarm-app/inc/Alert/AlertView.h b/alarm-app/inc/Alert/AlertView.h
index 4e64834..4911d21 100644
--- a/alarm-app/inc/Alert/AlertView.h
+++ b/alarm-app/inc/Alert/AlertView.h
@@ -48,13 +48,14 @@ namespace Alert
Evas_Object *createSnoozeButton(Evas_Object *parent);
Eina_Bool onRotaryEvent(Evas_Object *obj, Eext_Rotary_Event_Info *eventInfo);
- void onCancel();
+ Eina_Bool onCancel();
void onDismissClicked(Evas_Object *button, void *eventInfo);
void onSnoozeClicked(Evas_Object *button, void *eventInfo);
static void onButtonPressed(const char *signal, Evas_Object *button, void *eventInfo);
Evas_Object *m_DismissButton;
Evas_Object *m_SnoozeButton;
+ Ecore_Timer *m_Timer;
Common::Model::Alarm m_Alarm;
};
}
diff --git a/alarm-app/src/Alert/AlertView.cpp b/alarm-app/src/Alert/AlertView.cpp
index 1129403..b329f80 100644
--- a/alarm-app/src/Alert/AlertView.cpp
+++ b/alarm-app/src/Alert/AlertView.cpp
@@ -24,13 +24,15 @@
#include "AlertLayout.h"
#define SNOOZE_MAX_COUNT 3
+#define ALERT_MAX_TIME 60
using namespace Alert;
using namespace Common;
using namespace Common::Model;
AlertView::AlertView(Common::Model::Alarm alarm)
- : m_DismissButton(nullptr), m_SnoozeButton(nullptr), m_Alarm(std::move(alarm))
+ : m_DismissButton(nullptr), m_SnoozeButton(nullptr), m_Timer(nullptr),
+ m_Alarm(std::move(alarm))
{
}
@@ -61,6 +63,7 @@ Evas_Object *AlertView::onCreate(Evas_Object *parent)
elm_object_color_class_color_set(layout, COLOR_CLASS_SNOOZE_HIDDEN,
COLOR_BUTTON_SNOOZE, 0);
+ m_Timer = ecore_timer_add(ALERT_MAX_TIME, makeCallback(&AlertView::onCancel), this);
return layout;
}
@@ -79,8 +82,7 @@ void AlertView::onPageAttached(Ui::NavigatorPage *page)
bool AlertView::onBackPressed()
{
- onCancel();
- return false;
+ return onCancel();
}
Evas_Object *AlertView::createButton(Evas_Object *parent, const char *iconPath, Elm_Color_RGBA color,
@@ -135,7 +137,7 @@ Eina_Bool AlertView::onRotaryEvent(Evas_Object *obj, Eext_Rotary_Event_Info *eve
return EINA_TRUE;
}
-void AlertView::onCancel()
+Eina_Bool AlertView::onCancel()
{
if (m_Alarm.getSnoozeCount() < SNOOZE_MAX_COUNT) {
m_Alarm.snooze();
@@ -144,6 +146,8 @@ void AlertView::onCancel()
}
AlarmConsumer::getInstance().updateAlarm(m_Alarm, nullptr);
getPage()->close();
+
+ return EINA_FALSE;
}
void AlertView::onDismissClicked(Evas_Object *button, void *eventInfo)