diff options
author | jinwoo.shin <jw0227.shin@samsung.com> | 2015-07-14 14:14:48 +0900 |
---|---|---|
committer | jinwoo.shin <jw0227.shin@samsung.com> | 2015-07-14 14:14:48 +0900 |
commit | 7a8d96e57adaa93c25be136c8ae810a773c9b766 (patch) | |
tree | 5ae0bb76dbc15c25a911eed73e8af1a0f7102e63 | |
parent | 183923c7714edec234ad2f944492ffb48d83bdfc (diff) | |
download | air_livetv-7a8d96e57adaa93c25be136c8ae810a773c9b766.tar.gz air_livetv-7a8d96e57adaa93c25be136c8ae810a773c9b766.tar.bz2 air_livetv-7a8d96e57adaa93c25be136c8ae810a773c9b766.zip |
Add focus related handlings
Change-Id: Ib4023446f1778d0f32e4d7210f2a50ea7519f1eb
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r-- | src/layout_channelinfo_search.c | 14 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/view_channelinfo.c | 37 |
3 files changed, 51 insertions, 2 deletions
diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index ba04001..3a3aac4 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -43,7 +43,7 @@ struct _priv { static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) { - Evas_Object *ly, *divider; + Evas_Object *ly, *divider, *first; Evas *e; Eina_List *l; const struct tv_channel_info *channel_info; @@ -65,6 +65,7 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) elm_box_clear(priv->box); + first = NULL; EINA_LIST_FOREACH(channel_list, l, channel_info) { if (!channel_info->remembered) continue; @@ -78,6 +79,17 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) if (eina_list_next(l)) elm_box_pack_end(priv->box, divider); + + if (channel_info->service_id == current_service) + elm_object_focus_set(ly, EINA_TRUE); + + if (!first) + first = ly; + } + + if (first && ly) { + elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP); + elm_object_focus_next_object_set(ly, first, ELM_FOCUS_DOWN); } } @@ -104,7 +104,7 @@ static Evas_Object *_add_win(const char *name) return NULL; } elm_win_alpha_set(win, EINA_FALSE); - elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_focus_highlight_enabled_set(win, EINA_FALSE); elm_win_focus_highlight_style_set(win, "invisible"); evas_object_show(win); diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index 9d1c3a2..6e4296a 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -44,6 +44,33 @@ struct _priv { layoutmgr *lmgr; }; +static void _update(void *view_data, int type, void *data); + +static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_DOWN, ev); +} + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); +} + +void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + viewmgr_update_view(VIEW_CHANNELINFO, + UPDATE_TYPE_TIMER, START_HIDE_TIMER); +} + +static input_handler key_handler = { + .key_down = _key_down_cb, + .key_up = _key_up_cb, + .mouse_move = _mouse_move_cb, +}; + static int _get_program_time(char *buf, int buf_len, time_t start_time, time_t end_time) { @@ -306,6 +333,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_CHANNELINFO, priv); + inputmgr_add_callback(priv->base, 0, &key_handler, priv); + return priv->base; } @@ -355,6 +384,8 @@ static void _destroy(void *view_data) layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_SEARCH); layoutmgr_destroy(priv->lmgr); + inputmgr_remove_callback(priv->base, &key_handler); + evas_object_del(priv->base); free(priv); @@ -402,6 +433,8 @@ static void _update(void *view_data, int type, void *data) _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); layoutmgr_update_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST, type, ev); + } else { + _start_hide_timer(priv); } } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { Evas_Event_Key_Up *ev = data; @@ -418,6 +451,10 @@ static void _update(void *view_data, int type, void *data) _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); layoutmgr_update_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST, type, ev); + } else if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE) || + !strcmp(ev->keyname, KEY_EXIT)) { + viewmgr_hide_view(VIEW_CHANNELINFO); } } } |