From 5cb6a9d874ecbe5ed9777702e4ae87e459fc7ae2 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Thu, 23 Jul 2015 19:08:20 +0900 Subject: [PATCH] listmgr: add the function to update focus to play info Change-Id: I62e2aed712596bcddac31b9f0da11ba1914b41f5 Signed-off-by: Jehun Lim --- include/util/listmgr.h | 3 ++- src/layout/gallery.c | 2 +- src/layout/movie.c | 8 +------- src/layout/music.c | 13 +------------ src/util/listmgr.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/include/util/listmgr.h b/include/util/listmgr.h index d146532..48f21fe 100644 --- a/include/util/listmgr.h +++ b/include/util/listmgr.h @@ -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__ */ diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 5dad688..3e3e839 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -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: diff --git a/src/layout/movie.c b/src/layout/movie.c index e6c5289..ceb236f 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -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: diff --git a/src/layout/music.c b/src/layout/music.c index 746e4f7..4d6f3c5 100644 --- a/src/layout/music.c +++ b/src/layout/music.c @@ -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; diff --git a/src/util/listmgr.c b/src/util/listmgr.c index ff25f0c..9ea9d6c 100644 --- a/src/util/listmgr.c +++ b/src/util/listmgr.c @@ -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); -- 2.7.4