Commit ff488fb0 authored by Ludovic Fauvet's avatar Ludovic Fauvet

audio player: let the audio player handle the back button

This way we're able to actually close any open popup before it's too
late. It may be wise to apply the same kind of pf_event to this view as
well.
parent 4355efe3
...@@ -326,6 +326,23 @@ mini_player_fs_state(mini_player *mp) ...@@ -326,6 +326,23 @@ mini_player_fs_state(mini_player *mp)
return mp->fs_state; return mp->fs_state;
} }
bool
audio_player_handle_back_key(mini_player *mp)
{
if (mp->popup)
{
evas_object_del(mp->popup);
return true;
}
if (mini_player_fs_state(mp) == true)
{
collapse_fullscreen_player(mp);
return true;
}
return false;
}
static void static void
update_player_play_pause(mini_player* mpd) update_player_play_pause(mini_player* mpd)
{ {
...@@ -454,6 +471,14 @@ audio_player_more_popup_close_cb(void *data, Evas_Object *obj, void *event_info) ...@@ -454,6 +471,14 @@ audio_player_more_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
evas_object_del(obj); evas_object_del(obj);
} }
static void
audio_player_more_popup_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
mini_player *mpd = data;
mpd->popup = NULL;
}
static void static void
fs_more_player_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) fs_more_player_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
...@@ -479,6 +504,7 @@ fs_more_player_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) ...@@ -479,6 +504,7 @@ fs_more_player_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
evas_object_show(mpd->popup); evas_object_show(mpd->popup);
evas_object_smart_callback_add(mpd->popup, "block,clicked", audio_player_more_popup_close_cb, mpd); evas_object_smart_callback_add(mpd->popup, "block,clicked", audio_player_more_popup_close_cb, mpd);
evas_object_event_callback_add(mpd->popup, EVAS_CALLBACK_FREE, audio_player_more_popup_free_cb, mpd);
/* Change the more button img */ /* Change the more button img */
elm_image_file_set(mpd->fs_more_btn, ICON_DIR"ic_more_circle_pressed_o.png", NULL); elm_image_file_set(mpd->fs_more_btn, ICON_DIR"ic_more_circle_pressed_o.png", NULL);
......
...@@ -49,4 +49,7 @@ mini_player_fs_state(mini_player *); ...@@ -49,4 +49,7 @@ mini_player_fs_state(mini_player *);
void void
collapse_fullscreen_player(mini_player *); collapse_fullscreen_player(mini_player *);
bool
audio_player_handle_back_key(mini_player *);
#endif /* MINI_PLAYER_H_ */ #endif /* MINI_PLAYER_H_ */
...@@ -279,8 +279,8 @@ win_back_key_cb(void *data, Evas_Object *obj, void *event_info) ...@@ -279,8 +279,8 @@ win_back_key_cb(void *data, Evas_Object *obj, void *event_info)
elm_panel_hidden_set(intf->sidebar, EINA_TRUE); elm_panel_hidden_set(intf->sidebar, EINA_TRUE);
} }
/* Hide the audio_player then */ /* Hide the audio_player then */
else if (mini_player_fs_state(intf->p_mini_player) == true) { //FIXME else if (audio_player_handle_back_key(intf->p_mini_player) == true) { //FIXME
collapse_fullscreen_player(intf->p_mini_player); return;
} }
/* Finally pop out the stack */ /* Finally pop out the stack */
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment