From 5c1103a01f77096d7bf908c3f23cad359f683d38 Mon Sep 17 00:00:00 2001 From: Michal Skorupinski Date: Fri, 4 Mar 2016 17:37:08 +0100 Subject: [PATCH] [OAPBSA-62][UI] Proper focus next object is set The focus next object is used when the focus is switched from/to the tab buttons to the displayed layout objects. Channel, network and sound layouts are modified. Change-Id: I7369c35b2d5c2d29dd7cecd88f4c4d3241fbc1e7 Signed-off-by: Michal Skorupinski --- include/common/listmgr.h | 3 ++- src/common/listmgr.c | 7 ++++++- src/data/system/data_location.c | 3 ++- src/layout/layout_channel.c | 2 ++ src/layout/layout_network.c | 8 ++++++++ src/layout/layout_sound.c | 4 ++-- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/common/listmgr.h b/include/common/listmgr.h index 9f27a5c..0ef9213 100644 --- a/include/common/listmgr.h +++ b/include/common/listmgr.h @@ -49,7 +49,8 @@ bool listmgr_hide_grid(struct listmgr *listmgr, const char *list_id, * @param[in] reverse_dir Reverse direction */ void listmgr_set_list_next_focus(struct listmgr *listmgr, const char *list_id, - Evas_Object *obj_to_focus, Elm_Focus_Direction dir); + Evas_Object *obj_to_focus, Elm_Focus_Direction dir, + Eina_Bool add_reverse_link, Elm_Focus_Direction reverse_dir); bool listmgr_update_grid(struct listmgr *listmgr, const char *list_id); diff --git a/src/common/listmgr.c b/src/common/listmgr.c index f676bff..09b97af 100644 --- a/src/common/listmgr.c +++ b/src/common/listmgr.c @@ -388,7 +388,8 @@ bool listmgr_update_grid(struct listmgr *listmgr, const char *list_id) } void listmgr_set_list_next_focus(struct listmgr *listmgr, const char *list_id, - Evas_Object *obj_to_focus, Elm_Focus_Direction dir) + Evas_Object *obj_to_focus, Elm_Focus_Direction dir, + Eina_Bool add_reverse_link, Elm_Focus_Direction reverse_dir) { struct list_info *linfo = NULL; @@ -407,6 +408,10 @@ void listmgr_set_list_next_focus(struct listmgr *listmgr, const char *list_id, obj_to_focus = linfo->grid; elm_object_focus_next_object_set(linfo->grid, obj_to_focus, dir); + + if (add_reverse_link) { + elm_object_focus_next_object_set(obj_to_focus, linfo->grid, reverse_dir); + } } bool listmgr_hide_grid(struct listmgr *listmgr, const char *list_id, diff --git a/src/data/system/data_location.c b/src/data/system/data_location.c index c03a1f3..dab0aaf 100644 --- a/src/data/system/data_location.c +++ b/src/data/system/data_location.c @@ -213,5 +213,6 @@ void data_location_fill_list_data(struct listmgr *list_mgr, Elm_Object_Item **ge _ERR("Fill location list failed."); } listmgr_set_list_next_focus(list_mgr, LOCATION_LIST_ID, - NULL, ELM_FOCUS_UP); + NULL, ELM_FOCUS_UP, + EINA_FALSE, ELM_FOCUS_UP); } diff --git a/src/layout/layout_channel.c b/src/layout/layout_channel.c index 2f61daf..f0a3c8f 100644 --- a/src/layout/layout_channel.c +++ b/src/layout/layout_channel.c @@ -442,6 +442,8 @@ static bool _create(layoutmgr *lmgr, void *data) inputmgr_add_callback(priv->btn, 0, &_input_handler, priv); layoutmgr_set_layout_data(lmgr, LAYOUT_ID_CHANNEL, priv); + elm_object_focus_next_object_set(priv->btn, (Evas_Object*)data, ELM_FOCUS_UP); + return true; } diff --git a/src/layout/layout_network.c b/src/layout/layout_network.c index 3b6f9b3..f138f89 100644 --- a/src/layout/layout_network.c +++ b/src/layout/layout_network.c @@ -967,6 +967,14 @@ static bool _create(layoutmgr *lmgr, void *data) listmgr_add_inner_grid_cb(priv->listmgr, LIST_WIRELESS, &_grid_input_handler, NULL); + if(data) { + listmgr_set_list_next_focus(priv->listmgr, LIST_WIRELESS, + (Evas_Object *)data, ELM_FOCUS_UP, EINA_FALSE, ELM_FOCUS_DOWN); + + elm_object_focus_next_object_set((Evas_Object *)data, priv->network_type_btn, ELM_FOCUS_DOWN); + } + + return true; err: diff --git a/src/layout/layout_sound.c b/src/layout/layout_sound.c index 45704cd..275a2e0 100644 --- a/src/layout/layout_sound.c +++ b/src/layout/layout_sound.c @@ -181,9 +181,9 @@ static bool _create(layoutmgr *lmgr, void *data) if(data) { listmgr_set_list_next_focus(priv->list_mgr, LIST_SOUND_MODES_ID, - (Evas_Object *)data, ELM_FOCUS_UP); + (Evas_Object *)data, ELM_FOCUS_UP, EINA_TRUE, ELM_FOCUS_DOWN); listmgr_set_list_next_focus(priv->list_mgr, LIST_SPEAKERS_ID, - (Evas_Object *)data, ELM_FOCUS_UP); + (Evas_Object *)data, ELM_FOCUS_UP, EINA_FALSE, ELM_FOCUS_UP); } if (!_fill_lists(priv)) { -- 2.7.4