listmgr: add update parameter for listmgr_update_focus_item 30/44330/1
authorJehun Lim <jehun.lim@samsung.com>
Tue, 21 Jul 2015 04:16:47 +0000 (13:16 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Tue, 21 Jul 2015 04:20:29 +0000 (13:20 +0900)
Change-Id: Iffc69b0afea67a53ab78f9c362779f34ee8c37b5
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
include/util/listmgr.h
src/layout/gallery.c
src/layout/movie.c
src/layout/music.c
src/util/listmgr.c

index 50491bb..d146532 100644 (file)
@@ -54,6 +54,6 @@ bool listmgr_draw_list_area(struct listmgr *lmgr);
 bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list);
 bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info);
 
-bool listmgr_update_focus_item(struct listmgr *lmgr, int index);
+bool listmgr_update_focus_item(struct listmgr *lmgr, int index, bool update);
 
 #endif /* __AIR_MEDIAHUB_LISTMGR_H__ */
index 1a6f364..b85ef88 100644 (file)
@@ -50,6 +50,7 @@ struct _priv {
        struct listmgr_data *ldata;
 
        struct mediadata *md;
+       int cur_index;
 
        Eina_List *media_list;
 };
@@ -151,6 +152,7 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it)
 
        vdata.list = mediadata_get_medialist(priv->md);
        vdata.index = util_get_media_index(vdata.list, am);
+       priv->cur_index = vdata.index;
 
        viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata);
        viewmgr_push_view(VIEW_VIEWER);
@@ -356,6 +358,7 @@ static void _update(void *layout_data, int update_type, void *data)
 {
        struct _priv *priv;
        int index;
+       bool update;
 
        if (!layout_data) {
                _ERR("failed to get layout data");
@@ -375,7 +378,13 @@ static void _update(void *layout_data, int update_type, void *data)
                }
 
                index = *(int *)data;
-               listmgr_update_focus_item(priv->listmgr, index);
+
+               if (priv->cur_index != index)
+                       update = true;
+               else
+                       update = false;
+
+               listmgr_update_focus_item(priv->listmgr, index, update);
 
                break;
        default:
index a9df8fc..f5a8561 100644 (file)
@@ -58,6 +58,7 @@ struct _priv {
        struct progressbar *prog;
 
        Eina_List *media_list;
+       int cur_index;
 
        app_media *recent_info;
 };
@@ -262,6 +263,7 @@ static void _item_selected_cb(struct _priv *priv, app_media *am)
 
        vdata.list = mediadata_get_medialist(priv->md);
        vdata.index = util_get_media_index(vdata.list, am);
+       priv->cur_index = vdata.index;
 
        viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata);
        viewmgr_push_view(VIEW_VIEWER);
@@ -561,6 +563,7 @@ static void _update(void *layout_data, int update_type, void *data)
 {
        struct _priv *priv;
        int index;
+       bool update;
 
        if (!layout_data) {
                _ERR("failed to get layout data");
@@ -581,8 +584,13 @@ static void _update(void *layout_data, int update_type, void *data)
                }
 
                index = *(int *)data;
-               listmgr_update_focus_item(priv->listmgr, index);
 
+               if (priv->cur_index != index)
+                       update = true;
+               else
+                       update = false;
+
+               listmgr_update_focus_item(priv->listmgr, index, update);
                _update_recent_item(priv);
                break;
        default:
index fc1d128..b5e42da 100644 (file)
@@ -50,6 +50,7 @@ struct _priv {
        struct listmgr_data *ldata;
 
        struct mediadata *md;
+       int cur_index;
 
        Eina_List *media_list;
 };
@@ -137,6 +138,7 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it)
 
        vdata.list = mediadata_get_medialist(priv->md);
        vdata.index = util_get_media_index(vdata.list, am);
+       priv->cur_index = vdata.index;
 
        viewmgr_update_view(VIEW_MPLAYER, UPDATE_CONTENT, &vdata);
        viewmgr_push_view(VIEW_MPLAYER);
@@ -342,6 +344,7 @@ static void _update(void *layout_data, int update_type, void *data)
 {
        struct _priv *priv;
        int index;
+       bool update;
 
        if (!layout_data) {
                _ERR("failed to get layout data");
@@ -361,7 +364,13 @@ static void _update(void *layout_data, int update_type, void *data)
                }
 
                index = *(int *)data;
-               listmgr_update_focus_item(priv->listmgr, index);
+
+               if (priv->cur_index != index)
+                       update = true;
+               else
+                       update = false;
+
+               listmgr_update_focus_item(priv->listmgr, index, update);
 
                break;
        default:
index 181b362..6e9d07e 100644 (file)
@@ -346,13 +346,23 @@ static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi)
        return ly;
 }
 
-bool listmgr_update_focus_item(struct listmgr *lmgr, int index)
+bool listmgr_update_focus_item(struct listmgr *lmgr, int index, bool update)
 {
        Eina_List *item, *l;
-       Evas_Object *ly, *grid;
+       Evas_Object *ly, *grid, *content;
        Elm_Object_Item *it;
        int count;
 
+       if (!update) {
+               content = elm_object_part_content_get(lmgr->focused,
+                                       PART_ITEM_CONTENT);
+
+               lmgr->scr_focus = EINA_FALSE;
+               elm_object_focus_set(content, EINA_TRUE);
+
+               return true;
+       }
+
        item = elm_box_children_get(lmgr->box);
        if (lmgr->show_play_info)
                item = eina_list_next(item);