summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-09-11 11:10:55 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-09-11 11:29:47 (GMT)
commitcd93594a7b043b19dd0409d9b0ff79661244db9f (patch)
tree7a5f2e820d5278fe21f423b91a84f90d49664157
parentd0e1e45cb31ed7ab9d3210d1a364b5d227682e2a (diff)
downloadair_mediahub-tizen_3.0.m1_tv.zip
air_mediahub-tizen_3.0.m1_tv.tar.gz
air_mediahub-tizen_3.0.m1_tv.tar.bz2
Change-Id: I71c2bffbce9b747b8baa71047d06b6bd9236128f Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--src/util/listmgr.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/util/listmgr.c b/src/util/listmgr.c
index 9d2ac9d..30b23d1 100644
--- a/src/util/listmgr.c
+++ b/src/util/listmgr.c
@@ -57,6 +57,8 @@ struct listmgr {
Eina_Bool focus_state;
};
+Elm_Object_Item *_get_nearest_grid_item(struct listmgr *);
+
static void _index_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
{
Evas_Object *grid;
@@ -86,6 +88,7 @@ static void _view_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
{
Evas_Object *play_info;
Evas_Event_Key_Down *ev;
+ Elm_Object_Item *it;
struct listmgr *lmgr;
if (!data || !ei)
@@ -104,8 +107,13 @@ static void _view_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
play_info = elm_object_part_content_get(lmgr->focused,
PART_ITEM_CONTENT);
elm_object_focus_set(play_info, EINA_TRUE);
- } else
- elm_object_item_focus_set(lmgr->focused_it, EINA_TRUE);
+ } else {
+ it = lmgr->focused_it;
+ if (!it)
+ it = _get_nearest_grid_item(lmgr);
+
+ elm_object_item_focus_set(it, EINA_TRUE);
+ }
}
}
@@ -508,6 +516,39 @@ Elm_Object_Item *_get_grid_item(Evas_Object *grid, const char *id)
return NULL;
}
+Elm_Object_Item *_get_nearest_grid_item(struct listmgr *lmgr)
+{
+ Evas_Object *ly, *grid;
+ Elm_Object_Item *it;
+ struct grid_data *gdata;
+ int cnt;
+
+ ly = _get_box_first_item(lmgr->box);
+ if (!ly) {
+ _ERR("failed to get box first item");
+ return NULL;
+ }
+
+ grid = elm_object_part_content_get(ly, PART_ITEM_CONTENT);
+ if (!grid) {
+ _ERR("failed to get grid object");
+ return NULL;
+ }
+
+ gdata = lmgr->data->gdata;
+
+ /* find last item in first column */
+ cnt = elm_gengrid_items_count(grid);
+ if (cnt > gdata->item_num)
+ cnt = gdata->item_num;
+
+ it = elm_gengrid_first_item_get(grid);
+ while (--cnt)
+ it = elm_gengrid_item_next_get(it);
+
+ return it;
+}
+
void listmgr_set_focus_state(struct listmgr *lmgr, Eina_Bool state)
{
if (!lmgr) {
@@ -662,6 +703,8 @@ void listmgr_clear_content_list(struct listmgr *lmgr)
}
eina_list_free(list);
+
+ lmgr->focused_it = NULL;
}
bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list,
@@ -714,6 +757,8 @@ bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list,
elm_object_focus_allow_set(lmgr->scr, EINA_TRUE);
+ elm_scroller_region_show(lmgr->scr, 0, 0, 0, 0);
+
return true;
}