Commit febcfe1a authored by Ludovic Fauvet's avatar Ludovic Fauvet

mini player: add next/previous and auto-adjust sizing

parent e0520428
......@@ -34,8 +34,9 @@ collections
description{
state: "default" 0.0;
color: 245 245 245 255; // grey
min: 0 120;
max: -1 120;
aspect: 5.0 15.0;
aspect_preference: HORIZONTAL;
min: 0 80;
}
}
part{
......@@ -64,8 +65,8 @@ collections
to: "hub_background";
}
rel2 {
relative: 0.8 1.0;
to: "hub_background";
relative: 0.0 1.0;
to: "swallow.previous";
}
}
}
......@@ -73,7 +74,7 @@ collections
name: "hub_button";
type: RECT;
description{
state: "default" 0.0;
state: "" 0.0;
visible: 0;
rel1{
relative: 0.0 0.2;
......@@ -81,7 +82,7 @@ collections
to: "hub_background";
}
rel2{
relative: 1.0 0.95;
relative: 0.8 0.95;
to: "hub_background";
}
}
......@@ -94,21 +95,18 @@ collections
color: 0 0 0 255; // black
visible: 1;
rel1 {
relative: 0.2 0.0;
to: "hub_button";
to_x: "hub_button";
to_y: "hub_button";
relative: 1.2 0.0;
to: "swallow.cover";
}
rel2 {
relative: 0.8 0.5;
to: "hub_button";
to_x: "hub_button";
to_y: "hub_button";
relative: 0.0 0.5;
to: "swallow.previous";
}
text {
text: "title";
text: "title bla bla bla bla bla bla moulaf gruik pwet";
size: 22;
ellipsis: 0;
align: 0 0;
}
}
}
......@@ -119,19 +117,18 @@ collections
state: "pause" 0.0;
color: 70 70 70 255; // grey/black
rel1 {
relative: 0.2 0.5;
to: "hub_button";
relative: 1.2 0.5;
to: "swallow.cover";
}
rel2 {
relative: 0.8 1.0;
to: "hub_button";
to_x: "hub_button";
to_y: "hub_button";
relative: 0.0 1.0;
to: "swallow.previous";
}
text {
text: "subtitle";
text: "subtitle bla bla bla bla bla bla moulaf gruik pwet";
size: 20;
ellipsis: 0;
align: 0 0;
}
}
}
......@@ -143,34 +140,71 @@ collections
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
color: 255 0 0 255; // transparent grey
align: 0 0;
rel1 {
relative: 0.0 0.0;
to: "hub_button";
}
rel2 {
relative: 0.2 1.0;
relative: 0.15 1.0;
to: "hub_button";
to_x: "hub_button";
to_y: "hub_button";
}
}
}
part {
name: "swallow.previous";
type: SWALLOW;
description {
state: "default" 0.0;
aspect: 0.9 0.9;
aspect_preference: VERTICAL;
color: 255 0 0 255; // transparent grey
rel1 {
relative: -2.0 0.0;
to: "swallow.play";
}
rel2 {
relative: 1.0 1.0;
to: "swallow.play";
}
}
}
part {
name: "swallow.play";
type: SWALLOW;
description {
state: "pause" 0.0;
aspect: 1.0 1.0;
aspect: 0.9 0.9;
aspect_preference: VERTICAL;
color: 255 0 0 255; // transparent grey
rel1 {
relative: 0.8 0.0;
to: "hub_button";
relative: -2.0 0.0;
to: "swallow.next";
}
rel2 {
relative: 1.0 1.0;
to: "swallow.next";
}
}
}
part {
name: "swallow.next";
type: SWALLOW;
description {
state: "default" 0.0;
aspect: 0.9 0.9;
aspect_preference: VERTICAL;
color: 255 0 0 255; // transparent grey
align: 0.5 0.5;
rel1 {
relative: 1.0 0.0;
to_y: "hub_button";
offset: -100 0;
}
rel2 {
relative: 1.0 1.0;
to: "hub_button";
to_x: "hub_button";
to_y: "hub_button";
}
}
......
......@@ -49,7 +49,7 @@ struct audio_player {
Evas_Object *fs_time, *fs_total_time;
Evas_Object *fs_title, *fs_sub_title;
Evas_Object *play_pause_img;
Evas_Object *play_pause_img, *previous_img, *next_img;
Evas_Object *fs_play_pause_img, *fs_previous_img, *fs_next_img;
Evas_Object *fs_save_btn, *fs_playlist_btn, *fs_more_btn;
......@@ -809,6 +809,12 @@ swallow_mini_player(audio_player *mpd, Evas_Object *layout)
/* set the play/pause button */
mpd->play_pause_img = create_icon(layout, "ic_pause_circle_normal_o.png");
elm_object_part_content_set(layout, "swallow.play", mpd->play_pause_img);
/* set the next/previous buttons */
mpd->previous_img = create_icon(layout, "ic_widget_previous_normal.png");
elm_object_part_content_set(layout, "swallow.previous", mpd->previous_img);
mpd->next_img = create_icon(layout, "ic_widget_next_normal.png");
elm_object_part_content_set(layout, "swallow.next", mpd->next_img);
}
void
......@@ -1065,6 +1071,8 @@ audio_player_create(interface *intf, playback_service *p_ps, Evas_Object *layout
/* Add button callbacks */
evas_object_event_callback_add(mpd->play_pause_img, EVAS_CALLBACK_MOUSE_DOWN, play_pause_mouse_down_cb, mpd);
evas_object_event_callback_add(mpd->play_pause_img, EVAS_CALLBACK_MOUSE_UP, play_pause_mouse_up_cb, mpd);
evas_object_smart_callback_add(mpd->previous_img, "clicked", fs_previous_cb, mpd);
evas_object_smart_callback_add(mpd->next_img, "clicked", fs_next_cb, mpd);
edje_object_signal_callback_add(edje, "*clicked*", "expand_region", audio_player_fullscreen_edge_cb, mpd);
......
......@@ -425,6 +425,9 @@ create_main_box(interface *intf, Evas_Object *parent)
intf->p_mini_player = audio_player_create(intf, application_get_playback_service(intf->p_app), intf->mini_player_layout);
evas_object_hide(intf->mini_player_layout);
evas_object_size_hint_weight_set(intf->mini_player_layout, EVAS_HINT_FILL, 0.1);
evas_object_size_hint_align_set(intf->mini_player_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
/* */
evas_object_show(intf->nf_content);
......
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