modify scroll start / stop 10/108010/2
authorYoungHun Cho <hoon.cho@samsung.com>
Mon, 2 Jan 2017 09:56:10 +0000 (18:56 +0900)
committerYOUNG HUN JO <hoon.cho@samsung.com>
Mon, 2 Jan 2017 09:58:36 +0000 (01:58 -0800)
Change-Id: I8f9039c548286709cc4ee0cf6c7e9a3d28e62977
Signed-off-by: YoungHun Cho <hoon.cho@samsung.com>
.cproject
src/cluster_view.c

index e307377..9036413 100755 (executable)
--- a/.cproject
+++ b/.cproject
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.481743771" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.2102599528" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1070320025" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core_llvm37.armel.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core.public.20161129_1_llvm37.armel.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.312288874" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
@@ -74,6 +68,7 @@
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.247638963" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.982331969" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.c.compiler.option.1644890019" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core_llvm37.armel.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core.public.20161129_1_llvm37.armel.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1483034184" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
index cb20a29..0d8da7f 100755 (executable)
@@ -31,6 +31,8 @@
 #include "mouse.h"
 #include "screen_reader_handler.h"
 
+#define SCROLL_STOP_TIME 0.05
+
 static struct {
        Evas_Object *win;
        Evas_Object *scroller;
@@ -46,6 +48,7 @@ static struct {
        cluster_page_t *picked_page;
        widget_data_t *picked_widget;
        Ecore_Timer *edit_mode_scroll_timer;
+       Ecore_Timer *scroll_stop_timer;
        bool is_srolling;
        Ecore_Animator *edit_animator;
        int animation_from_x;
@@ -66,6 +69,7 @@ static struct {
        .picked_page = NULL,
        .picked_widget = NULL,
        .edit_mode_scroll_timer = NULL,
+       .scroll_stop_timer = NULL,
        .is_srolling = false,
        .edit_animator = NULL,
        .animation_from_x = INIT_VALUE,
@@ -147,7 +151,10 @@ static Eina_Bool __cluster_view_scroll_timer_cb(void *data);
 
 static void __cluster_view_scroll_drag_start_cb(void *data, Evas_Object *obj, void *event_info);
 static void __cluster_view_scroll_drag_stop_cb(void *data, Evas_Object *obj, void *event_info);
+static void __cluster_view_scroll_anim_start_cb(void *data, Evas_Object *obj, void *event_info);
 static void __cluster_view_scroll_anim_stop_cb(void *data, Evas_Object *obj, void *event_info);
+static void __cluster_view_scroll_start(void);
+static Eina_Bool __cluster_view_scorll_stop(void *data);
 static void __cluster_view_allpage_get_page_pos(int page_idx, int *w, int *h);
 static int __cluster_view_allpage_get_page_index(int x, int y);
 static void __cluster_view_allpage_reposition(void);
@@ -185,6 +192,11 @@ void cluster_view_init(void)
 
 void cluster_view_app_terminate(void)
 {
+       evas_object_smart_callback_del(cluster_view_s.scroller, "scroll,drag,start", __cluster_view_scroll_drag_start_cb);
+       evas_object_smart_callback_del(cluster_view_s.scroller, "scroll,drag,stop", __cluster_view_scroll_drag_stop_cb);
+       evas_object_smart_callback_del(cluster_view_s.scroller, "scroll,anim,start", __cluster_view_scroll_anim_start_cb);
+       evas_object_smart_callback_del(cluster_view_s.scroller, "scroll,anim,stop", __cluster_view_scroll_anim_stop_cb);
+
        evas_object_event_callback_del(cluster_view_s.scroller, EVAS_CALLBACK_MOUSE_DOWN, __clsuter_view_scroller_down_cb);
        evas_object_event_callback_del(cluster_view_s.scroller, EVAS_CALLBACK_MOUSE_MOVE, __clsuter_view_scroller_move_cb);
        evas_object_event_callback_del(cluster_view_s.scroller, EVAS_CALLBACK_MOUSE_UP, __clsuter_view_scroller_up_cb);
@@ -239,9 +251,10 @@ Evas_Object *__cluster_view_create_base_gui(Evas_Object *win)
        evas_object_event_callback_add(cluster_view_s.scroller, EVAS_CALLBACK_MOUSE_MOVE, __clsuter_view_scroller_move_cb, NULL);
        evas_object_event_callback_add(cluster_view_s.scroller, EVAS_CALLBACK_MOUSE_UP, __clsuter_view_scroller_up_cb, NULL);
 
-       evas_object_smart_callback_add(cluster_view_s.scroller, "scroll,anim,stop", __cluster_view_scroll_anim_stop_cb, NULL);
        evas_object_smart_callback_add(cluster_view_s.scroller, "scroll,drag,start", __cluster_view_scroll_drag_start_cb, NULL);
        evas_object_smart_callback_add(cluster_view_s.scroller, "scroll,drag,stop", __cluster_view_scroll_drag_stop_cb, NULL);
+       evas_object_smart_callback_add(cluster_view_s.scroller, "scroll,anim,start", __cluster_view_scroll_anim_start_cb, NULL);
+       evas_object_smart_callback_add(cluster_view_s.scroller, "scroll,anim,stop", __cluster_view_scroll_anim_stop_cb, NULL);
 
        cluster_view_s.box = elm_box_add(cluster_view_s.scroller);
        elm_box_horizontal_set(cluster_view_s.box, EINA_TRUE);
@@ -720,9 +733,11 @@ static void __cluster_view_scroll_to_home(void)
 static void __cluster_view_scroll_to_page(int page_idx, bool animation)
 {
        if (animation) {
+               LOGD("bring in %d page", page_idx);
                elm_scroller_page_bring_in(cluster_view_s.scroller, page_idx, 0);
        } else {
                page_indicator_set_current_page(cluster_view_s.indicator, page_idx);
+               LOGD("show %d page", page_idx);
                elm_scroller_page_show(cluster_view_s.scroller, page_idx, 0);
        }
 }
@@ -1635,11 +1650,41 @@ static Eina_Bool __cluster_view_scroller_long_press_time_cb(void *data)
 
        return ECORE_CALLBACK_CANCEL;
 }
+
 static void __cluster_view_scroll_drag_start_cb(void *data, Evas_Object *obj, void *event_info)
 {
+       __cluster_view_scroll_start();
+}
+
+static void __cluster_view_scroll_drag_stop_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       if (cluster_view_s.scroll_stop_timer) {
+               ecore_timer_del(cluster_view_s.scroll_stop_timer);
+               cluster_view_s.scroll_stop_timer = NULL;
+       }
+
+       cluster_view_s.scroll_stop_timer = ecore_timer_add(SCROLL_STOP_TIME, __cluster_view_scorll_stop, NULL);
+}
+
+static void __cluster_view_scroll_anim_start_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       if (cluster_view_s.scroll_stop_timer) {
+               ecore_timer_del(cluster_view_s.scroll_stop_timer);
+               cluster_view_s.scroll_stop_timer = NULL;
+       }
+}
+
+static void __cluster_view_scroll_anim_stop_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       __cluster_view_scorll_stop(NULL);
+}
+
+static void __cluster_view_scroll_start(void)
+{
        screen_reader_update(CLEAR);
 
        cluster_view_s.is_srolling = true;
+
        cluster_page_t *current_page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
        Eina_List *find_list = NULL;
        widget_data_t *item;
@@ -1649,23 +1694,25 @@ static void __cluster_view_scroll_drag_start_cb(void *data, Evas_Object *obj, vo
        }
 }
 
-static void __cluster_view_scroll_drag_stop_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       cluster_view_s.is_srolling = false;
-}
-
-static void __cluster_view_scroll_anim_stop_cb(void *data, Evas_Object *obj, void *event_info)
+static Eina_Bool __cluster_view_scorll_stop(void *data)
 {
-       char buf[STR_MAX] = { 0 , };
+       if (!cluster_view_s.is_srolling) {
+               LOGE("scroll is already stopped");
+               return ECORE_CALLBACK_CANCEL;
+       }
 
        cluster_view_s.is_srolling = false;
-       elm_scroller_current_page_get(obj, &cluster_view_s.current_page, NULL);
+
+       elm_scroller_current_page_get(cluster_view_s.scroller, &cluster_view_s.current_page, NULL);
        cluster_view_s.current_page = cluster_view_s.current_page % cluster_view_s.page_count;
        LOGD("current page %d", cluster_view_s.current_page);
 
+       char buf[STR_MAX] = { 0 , };
        snprintf(buf, sizeof(buf), _("IDS_HS_TBOPT_PAGE_P1SD_OF_P2SD"), cluster_view_s.current_page + 1, cluster_view_s.page_count);
        screen_reader_read(buf);
        screen_reader_update(HOME);
+
+       return ECORE_CALLBACK_CANCEL;
 }
 
 static Eina_Bool __cluster_view_scroll_timer_cb(void *data)