From cc8927db2d68a7ccccc9f7b0d8426c7644e8ec6f Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 21 Jul 2015 18:37:08 +0900 Subject: [PATCH] musicplayer: add key down callback at genlist Change-Id: I0a49583b1d9de5e6031522875877091026a69dbf Signed-off-by: Minkyu Kang --- src/view/mplayer.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/view/mplayer.c b/src/view/mplayer.c index 261e9de..b75b14d 100644 --- a/src/view/mplayer.c +++ b/src/view/mplayer.c @@ -256,7 +256,6 @@ static void _player_play_pause(struct _priv *priv) progressbar_start(priv->progress); playermgr_play(priv->player, mi->file_path, 0); - break; default: _ERR("player was not created"); @@ -366,6 +365,32 @@ static void _callback_music(void *data, const char *ev) } } +static void _pop_view(struct _priv *priv) +{ + struct view_update_data vdata; + + vdata.index = priv->playlist.cur; + + viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata); + viewmgr_pop_view(); +} + +static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) +{ + struct _priv *priv; + + if (!data || !ev) + return; + + priv = data; + + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + _pop_view(priv); + } +} + static void _list_set_focus(struct _priv *priv) { struct _list_data *ld; @@ -489,6 +514,7 @@ static input_handler _list_handler = { .realized = _list_realized, .selected = _list_selected, .mouse_move = _list_mouse_move, + .key_down = _key_down, }; static void _add_playlist_item(struct _priv *priv) -- 2.7.4