listmgr: add the function to update focus to play info 20/44620/1
authorJehun Lim <jehun.lim@samsung.com>
Thu, 23 Jul 2015 10:08:20 +0000 (19:08 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Fri, 24 Jul 2015 02:14:57 +0000 (11:14 +0900)
Change-Id: I62e2aed712596bcddac31b9f0da11ba1914b41f5
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 d146532..48f21fe 100644 (file)
@@ -54,6 +54,7 @@ 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 update);
+bool listmgr_focus_content_list(struct listmgr *lmgr, int index, bool update);
+bool listmgr_focus_play_info(struct listmgr *lmgr);
 
 #endif /* __AIR_MEDIAHUB_LISTMGR_H__ */
index 5dad688..3e3e839 100644 (file)
@@ -403,7 +403,7 @@ static void _update(void *layout_data, int update_type, void *data)
                else
                        update = false;
 
-               listmgr_update_focus_item(priv->listmgr, vdata->index, update);
+               listmgr_focus_content_list(priv->listmgr, vdata->index, update);
 
                break;
        default:
index e6c5289..ceb236f 100644 (file)
@@ -581,7 +581,6 @@ static void _update(void *layout_data, int update_type, void *data)
 {
        struct view_update_data *vdata;
        struct _priv *priv;
-       bool update;
 
        if (!layout_data) {
                _ERR("failed to get layout data");
@@ -602,12 +601,7 @@ static void _update(void *layout_data, int update_type, void *data)
                        return;
                }
 
-               if (priv->cur_index != vdata->index)
-                       update = true;
-               else
-                       update = false;
-
-               listmgr_update_focus_item(priv->listmgr, vdata->index, update);
+               listmgr_focus_play_info(priv->listmgr);
                _update_recent_item(priv);
                break;
        default:
index 746e4f7..4d6f3c5 100644 (file)
@@ -528,7 +528,6 @@ static void _update(void *layout_data, int update_type, void *data)
 {
        struct view_update_data *vdata;
        struct _priv *priv;
-       bool update;
 
        if (!layout_data) {
                _ERR("failed to get layout data");
@@ -551,17 +550,7 @@ static void _update(void *layout_data, int update_type, void *data)
                _update_playing_item(priv, vdata->index);
                break;
        case UPDATE_FOCUS:
-               if (!vdata) {
-                       _ERR("invalid argument");
-                       return;
-               }
-
-               if (priv->cur_index != vdata->index)
-                       update = true;
-               else
-                       update = false;
-
-               listmgr_update_focus_item(priv->listmgr, vdata->index, update);
+               listmgr_focus_play_info(priv->listmgr);
                break;
        default:
                break;
index ff25f0c..9ea9d6c 100644 (file)
@@ -375,21 +375,50 @@ 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 update)
+bool _focus_to_content(struct listmgr *lmgr, Evas_Object *base)
+{
+       Evas_Object *content;
+
+       content = elm_object_part_content_get(base, PART_ITEM_CONTENT);
+       if (!content) {
+               _ERR("failed to get content");
+               return false;
+       }
+
+       lmgr->scr_focus = EINA_FALSE;
+       elm_object_focus_set(content, EINA_TRUE);
+
+       return true;
+}
+
+bool listmgr_focus_play_info(struct listmgr *lmgr)
+{
+       if (!lmgr) {
+               _ERR("failed to get listmgr");
+               return false;
+       }
+
+       if (!_focus_to_content(lmgr, lmgr->play_info)) {
+               _ERR("failed to focus to content");
+               return false;
+       }
+
+       return true;
+}
+
+bool listmgr_focus_content_list(struct listmgr *lmgr, int index, bool update)
 {
        Eina_List *item, *l;
-       Evas_Object *ly, *grid, *content;
+       Evas_Object *ly, *grid;
        Elm_Object_Item *it;
        int count;
+       int r;
 
        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;
+               r = _focus_to_content(lmgr, lmgr->focused);
+               if (!r)
+                       _ERR("failed to focus to content");
+               return r;
        }
 
        item = elm_box_children_get(lmgr->box);