View: Apply animation to show/hide of action menu view 10/47810/4
authorHyojung Jo <hj903.jo@samsung.com>
Wed, 9 Sep 2015 05:21:46 +0000 (14:21 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Wed, 9 Sep 2015 08:39:15 +0000 (17:39 +0900)
Change-Id: I0ef09f4759598d825955aac68e5d8fb35702564a
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/define.h
res/favorite.edc
src/view/view_action_menu.c

index f0c3675..af44081 100644 (file)
@@ -78,6 +78,9 @@
 #define SIG_DISABLE "elm,state,disabled"
 #define SIG_TOGGLE "toggle"
 #define SIG_TIMEOUT "timeout"
+#define SIG_SHOW "show"
+#define SIG_HIDE "hide"
+#define SIG_HIDE_DONE "hide.done"
 
 /* Source */
 #define SRC_EDC "edc"
@@ -88,6 +91,8 @@
 /* Transition */
 #define TRANSITION_FOCUS DECELERATE 0.20
 #define TRANSITION_CLICK DECELERATE 0
+#define TRANSITION_MENU_SHOW SIN 0.45
+#define TRANSITION_MENU_HIDE DECEL 0.3
 
 /* Text */
 #define STR_FAVORITE "Favorite"
index 13873fb..0e73759 100644 (file)
@@ -345,6 +345,25 @@ collections {
                name, GRP_VIEW_ACTION_MENU;
                parts {
                        part {
+                               name, "reference";
+                               type, RECT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 500 0;
+                                       rel1.relative, 1.0 0.0;
+                                       align, 0.0 0.5;
+                                       fixed, 1 0;
+                                       visible, 0;
+                               }
+                               description {
+                                       state, "show" 0.0;
+                                       inherit, "default" 0.0;
+                                       min, 0 0;
+                               }
+                       }
+
+                       part {
                                name, "bg.dark";
                                type, RECT;
                                scale, 1;
@@ -361,11 +380,19 @@ collections {
                                description {
                                        state, "default" 0.0;
                                        color, 255 255 255 255;
-                                       rel1.relative, 1.0 0.0;
+                                       rel1 {
+                                               to, "reference";
+                                               relative, 1.0 0.0;
+                                       }
+                                       rel2.to, "reference";
                                        min, 500 0;
                                        align, 1.0 0.5;
                                        fixed, 1 0;
                                }
+                               description {
+                                       state, "show" 0.0;
+                                       inherit, "default" 0.0;
+                               }
                        }
 
                        part {
@@ -512,6 +539,34 @@ collections {
                                }
                        }
                }
+
+               programs {
+                       program {
+                               name, SIG_SHOW;
+                               signal, SIG_SHOW;
+                               source, SRC_EDC;
+                               action, STATE_SET "show" 0.0;
+                               transition, TRANSITION_MENU_SHOW;
+                               target, "reference";
+                               target, "bg";
+                       }
+
+                       program {
+                               name, SIG_HIDE;
+                               signal, SIG_HIDE;
+                               source, SRC_EDC;
+                               action, STATE_SET "default" 0.0;
+                               transition, TRANSITION_MENU_HIDE;
+                               target, "reference";
+                               target, "bg";
+                               after, SIG_HIDE_DONE;
+                       }
+
+                       program {
+                               name, SIG_HIDE_DONE;
+                               action, SIGNAL_EMIT SIG_HIDE_DONE SRC_EDC;
+                       }
+               }
        }
 
        group {
index 6b719e0..eb053ba 100644 (file)
@@ -72,18 +72,22 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
                elm_object_focus_set(obj, EINA_TRUE);
 }
 
-static void _livetv_selected(void)
+static void _livetv_selected(struct _priv *priv)
 {
        if (!utils_launch_app(APP_ID_LIVETV, NULL, NULL)) {
                _ERR("Launch live tv failed.");
                return;
        }
 
-       viewmgr_hide_view(VIEW_ACTION_MENU);
+       elm_object_signal_emit(priv->base, SIG_HIDE, SRC_EDC);
 }
 
-static void _favorite_selected(struct grid_data *gdata)
+static void _favorite_selected(struct _priv *priv)
 {
+       struct grid_data *gdata;
+
+       gdata = priv->gdata;
+
        if (!gdata->item_action(gdata->focused_item,
                                ACTION_UPDATE_FAVORITE, NULL)) {
                _ERR("Unfavorite failed.");
@@ -92,7 +96,7 @@ static void _favorite_selected(struct grid_data *gdata)
 
        viewmgr_update_view(VIEW_BASE, UPDATE_GRID, gdata);
        viewmgr_update_view(VIEW_BASE, UPDATE_SHOW_TOAST, STR_REMOVE_FAVORITE);
-       viewmgr_hide_view(VIEW_ACTION_MENU);
+       elm_object_signal_emit(priv->base, SIG_HIDE, SRC_EDC);
 }
 
 static void _lock_selected(struct grid_data *gdata)
@@ -117,11 +121,11 @@ static void _clicked_cb(int id, void *data, Evas_Object *obj)
 
        switch (id) {
        case BTN_LIVETV:
-               _livetv_selected();
+               _livetv_selected(priv);
                break;
 
        case BTN_FAVORITE:
-               _favorite_selected(priv->gdata);
+               _favorite_selected(priv);
                break;
 
        case BTN_LOCK:
@@ -136,14 +140,17 @@ static void _clicked_cb(int id, void *data, Evas_Object *obj)
 static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
                Evas_Event_Key_Down *ev)
 {
-       if (!ev) {
+       struct _priv *priv;
+
+       if (!data || !ev) {
                _ERR("Invalid argument.");
                return;
        }
+       priv = data;
 
        if (!strcmp(ev->keyname, KEY_BACK)
                        || !strcmp(ev->keyname, KEY_BACK_REMOTE))
-               viewmgr_hide_view(VIEW_ACTION_MENU);
+               elm_object_signal_emit(priv->base, SIG_HIDE, SRC_EDC);
 }
 
 static input_handler _btn_input_handler = {
@@ -284,6 +291,12 @@ static bool _draw_banner_area(struct _priv *priv)
        return true;
 }
 
+static void _hide_done_cb(void *data, Evas_Object *obj,
+               const char *emmision, const char *source)
+{
+       viewmgr_hide_view(VIEW_ACTION_MENU);
+}
+
 static Evas_Object *_create(Evas_Object *win, void *data)
 {
        struct _priv *priv;
@@ -317,6 +330,9 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
+       elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDC,
+                       _hide_done_cb, NULL);
+
        _draw_livetv_area(priv);
 
        return base;
@@ -335,6 +351,10 @@ static void _show(void *data)
        if (priv->base)
                evas_object_show(priv->base);
 
+       _draw_action_area(priv);
+       _draw_banner_area(priv);
+
+       elm_object_signal_emit(priv->base, SIG_SHOW, SRC_EDC);
        elm_object_focus_set(priv->live_btn, EINA_TRUE);
 }
 
@@ -370,8 +390,6 @@ static void _update(void *view_data, int update_type, void *data)
                        return;
 
                priv->gdata = data;
-               _draw_action_area(priv);
-               _draw_banner_area(priv);
        }
 }