diff options
author | Sergii Kyryliuk <s.kyryliuk@partner.samsung.com> | 2017-03-21 11:07:40 +0200 |
---|---|---|
committer | Sergii Kyryliuk <s.kyryliuk@partner.samsung.com> | 2017-03-21 13:53:55 +0200 |
commit | 35338e9a5be1d3bcbc5801617c9403e08f243adc (patch) | |
tree | f7f4190a2fbe3a644b5d197d414d8d0b6d899683 | |
parent | 064eaf5da72bc90edd3d61d3094820c6bb647f44 (diff) | |
download | alarm-35338e9a5be1d3bcbc5801617c9403e08f243adc.tar.gz alarm-35338e9a5be1d3bcbc5801617c9403e08f243adc.tar.bz2 alarm-35338e9a5be1d3bcbc5801617c9403e08f243adc.zip |
TizenRefApp-8180 Implement vibrating on alert
Change-Id: I456543ce03d12579cb1b4c1f8d7f4cfd448c030c
Signed-off-by: Sergii Kyryliuk <s.kyryliuk@partner.samsung.com>
-rw-r--r-- | alarm-app/inc/Alert/AlertView.h | 2 | ||||
-rw-r--r-- | alarm-app/inc/OperationAlertController.h | 3 | ||||
-rw-r--r-- | alarm-app/src/Alert/AlertView.cpp | 15 | ||||
-rw-r--r-- | alarm-app/src/OperationAlertController.cpp | 16 | ||||
-rw-r--r-- | alarm-app/tizen-manifest.xml | 2 |
5 files changed, 37 insertions, 1 deletions
diff --git a/alarm-app/inc/Alert/AlertView.h b/alarm-app/inc/Alert/AlertView.h index 73b8fb0..bb2bd1a 100644 --- a/alarm-app/inc/Alert/AlertView.h +++ b/alarm-app/inc/Alert/AlertView.h @@ -60,11 +60,13 @@ namespace Alert static void onButtonPressed(const char *signal, Evas_Object *button, void *eventInfo); static Eina_Bool onButtonActivated(Evas_Object *button, Evas_Object *obj, Elm_Access_Action_Info *accessInfo); + static Eina_Bool onFeedbackTimer(void *data); Evas_Object *m_DismissButton; Evas_Object *m_SnoozeButton; Ecore_Timer *m_Timer; player_h m_Player; + Ecore_Timer *m_FeedbackTimer; Common::Model::Alarm m_Alarm; }; } diff --git a/alarm-app/inc/OperationAlertController.h b/alarm-app/inc/OperationAlertController.h index fa0a412..d27133a 100644 --- a/alarm-app/inc/OperationAlertController.h +++ b/alarm-app/inc/OperationAlertController.h @@ -21,7 +21,10 @@ class OperationAlertController : public App::OperationController { +public: + virtual ~OperationAlertController() override; private: + virtual void onCreate() override; virtual void onRequest(const char *operation, app_control_h request) override; }; diff --git a/alarm-app/src/Alert/AlertView.cpp b/alarm-app/src/Alert/AlertView.cpp index ea1ab57..c73c66d 100644 --- a/alarm-app/src/Alert/AlertView.cpp +++ b/alarm-app/src/Alert/AlertView.cpp @@ -25,8 +25,11 @@ #include "Utils/Logger.h" #include "AlertLayout.h" +#include <feedback.h> + #define SNOOZE_MAX_COUNT 3 #define ALERT_MAX_TIME 60 +#define FEEDBACK_TIME 1.0 #define DEFAULT_SOUND_PATH "/opt/share/settings/Alarms/Alarms_on_call.ogg" using namespace Alert; @@ -35,7 +38,7 @@ using namespace Common::Model; AlertView::AlertView(Common::Model::Alarm alarm) : m_DismissButton(nullptr), m_SnoozeButton(nullptr), - m_Timer(nullptr), m_Player(createPlayer()), + m_Timer(nullptr), m_Player(createPlayer()), m_FeedbackTimer(nullptr), m_Alarm(std::move(alarm)) { } @@ -83,6 +86,7 @@ Evas_Object *AlertView::onCreate(Evas_Object *parent) COLOR_BUTTON_SNOOZE, 0); m_Timer = ecore_timer_add(ALERT_MAX_TIME, makeCallback(&AlertView::onCancel), this); + return layout; } @@ -92,8 +96,11 @@ void AlertView::onNavigation(bool isCurrent) if (isCurrent) { player_start(m_Player); + m_FeedbackTimer = ecore_timer_add(FEEDBACK_TIME, onFeedbackTimer, this); } else { player_stop(m_Player); + ecore_timer_del(m_FeedbackTimer); + m_FeedbackTimer = nullptr;; if (!elm_win_focus_get(findParent<Ui::Window>()->getEvasObject())) { onCancel(); } @@ -240,3 +247,9 @@ Eina_Bool AlertView::onButtonActivated(Evas_Object *button, Evas_Object *obj, elm_layout_signal_emit(button, SIGNAL_BUTTON_PRESS, ""); return EINA_TRUE; } + +Eina_Bool AlertView::onFeedbackTimer(void *data) +{ + feedback_play(FEEDBACK_PATTERN_WAKEUP); + return ECORE_CALLBACK_RENEW; +} diff --git a/alarm-app/src/OperationAlertController.cpp b/alarm-app/src/OperationAlertController.cpp index fd7bce6..da5bb63 100644 --- a/alarm-app/src/OperationAlertController.cpp +++ b/alarm-app/src/OperationAlertController.cpp @@ -20,9 +20,25 @@ #include "App/AppControlUtils.h" #include "Ui/Navigator.h" +#include "Ui/Window.h" + +#include <efl_util.h> +#include <feedback.h> using namespace Common::Model; +OperationAlertController::~OperationAlertController() +{ + efl_util_set_window_screen_mode(getWindow()->getEvasObject(), EFL_UTIL_SCREEN_MODE_DEFAULT); + feedback_deinitialize(); +} + +void OperationAlertController::onCreate() +{ + feedback_initialize(); + efl_util_set_window_screen_mode(getWindow()->getEvasObject(), EFL_UTIL_SCREEN_MODE_ALWAYS_ON); +} + void OperationAlertController::onRequest(const char *operation, app_control_h request) { int id = App::getIntExtraData(request, APP_CONTROL_DATA_ID); diff --git a/alarm-app/tizen-manifest.xml b/alarm-app/tizen-manifest.xml index 3a4eaa6..e5b757a 100644 --- a/alarm-app/tizen-manifest.xml +++ b/alarm-app/tizen-manifest.xml @@ -174,5 +174,7 @@ </ui-application> <privileges> <privilege>http://tizen.org/privilege/datasharing</privilege> + <privilege>http://tizen.org/privilege/haptic</privilege> + <privilege>http://tizen.org/privilege/display</privilege> </privileges> </manifest> |