From: Yunjin Lee Date: Mon, 30 Apr 2018 08:17:02 +0000 (+0900) Subject: Handling rotary event for wearable circle UI X-Git-Tag: submit/tizen/20180604.095416~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71c77469561663ee40a81b4f5aca234dbbcedbf5;p=platform%2Fcore%2Fsecurity%2Faskuser.git Handling rotary event for wearable circle UI - To enable scrolling using wearable circle bazel, add scroller on layout and make it scroll according to the rotary event direction. Change-Id: Ic4dd17738a0f75f5126ec55204dcee9a7f9138f8 Signed-off-by: Yunjin Lee --- diff --git a/packaging/askuser-notification.spec b/packaging/askuser-notification.spec index e38b55e..f6b6251 100644 --- a/packaging/askuser-notification.spec +++ b/packaging/askuser-notification.spec @@ -30,6 +30,7 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(aul) BuildRequires: edje-bin +BuildRequires: pkgconfig(efl-extension) %if !%{defined build_type} %define build_type RELEASE diff --git a/src/notification-daemon/CMakeLists.txt b/src/notification-daemon/CMakeLists.txt index c01f1ea..77d8df2 100644 --- a/src/notification-daemon/CMakeLists.txt +++ b/src/notification-daemon/CMakeLists.txt @@ -12,6 +12,7 @@ PKG_CHECK_MODULES(ASKUSER_NOTIFICATION_DEP glib-2.0 capi-ui-efl-util capi-system-info + efl-extension ) INCLUDE_DIRECTORIES(SYSTEM diff --git a/src/notification-daemon/ui/PopupCheckWearable.h b/src/notification-daemon/ui/PopupCheckWearable.h index 1b1af55..a5746f3 100644 --- a/src/notification-daemon/ui/PopupCheckWearable.h +++ b/src/notification-daemon/ui/PopupCheckWearable.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include #include "Po.h" @@ -36,7 +37,25 @@ public: : PopupCheck(parent, msg) {} ~PopupCheckWearable() {} - + static Eina_Bool rotaryChangedCb(void *data, Evas_Object *, Eext_Rotary_Event_Info *info) { + Evas_Object *scroller = (Evas_Object *)data; + Evas_Coord sx, sy, sw, sh, y, h; + elm_scroller_region_get(scroller, &sx, &sy, &sw, &sh); + evas_object_geometry_get(scroller, NULL, &y, NULL, &h); + + if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) { + if (sy + (sh/2) <= y + sh + h) + elm_scroller_region_bring_in(scroller, sx, sy+(sh/2), sw, sh); + else if (sy < y + sh + h) + elm_scroller_region_bring_in(scroller, sx, y + sh + h, sw, sh); + } else { + if (sy - (sh/2) >= 0) + elm_scroller_region_bring_in(scroller, sx, sy-(sh/2), sw, sh); + else if (sy > 0) + elm_scroller_region_bring_in(scroller, sx, 0, sw, sh); + } + return EINA_TRUE; + } virtual void create() { elm_object_style_set(m_popup, "circle"); @@ -49,14 +68,23 @@ public: elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str()); elm_object_content_set(m_popup, m_layout); - m_layoutInner = elm_layout_add(m_layout); + m_scroller = elm_scroller_add(m_layout); + elm_scroller_policy_set(m_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(m_scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(m_layout, "elm.swallow.content", m_scroller); + + m_layoutInner = elm_layout_add(m_scroller); if (m_layoutInner == nullptr) { ALOGE("EFL : Failed to add layout"); throw Exception("Enlightenment failed"); } elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal"); evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner); + elm_object_content_set(m_scroller, m_layoutInner); + + eext_rotary_object_event_callback_add(m_scroller, rotaryChangedCb, m_scroller); + eext_rotary_object_event_activated_set(m_scroller, EINA_TRUE); m_content = elm_label_add(m_layoutInner); if (m_content == nullptr) { @@ -126,6 +154,7 @@ private: Evas_Object *m_content = nullptr; Evas_Object *m_layout = nullptr; Evas_Object *m_layoutInner = nullptr; + Evas_Object *m_scroller = nullptr; }; } /* namespace Notification */