summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kurzberg <i.kurtsberg@samsung.com>2017-02-21 11:12:07 +0200
committerAleksandr Sapozhnik <a.sapozhnik@samsung.com>2017-02-22 06:41:55 -0800
commitbc224acfe07d1fe3a89524b39f8c91f8a7be31fb (patch)
tree8be7142bafb8226b5ae54fe08022e4b5f4f8d166
parent8b37873c307a219ecba45a083dbe7be281140ef5 (diff)
downloadalarm-bc224acfe07d1fe3a89524b39f8c91f8a7be31fb.tar.gz
alarm-bc224acfe07d1fe3a89524b39f8c91f8a7be31fb.tar.bz2
alarm-bc224acfe07d1fe3a89524b39f8c91f8a7be31fb.zip
TizenRefApp-8032 Implement one minute Alert duration
Change-Id: Ia19c60c6ebc660f4215bc5f32b5132e117724197 Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
-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)