rel2 { relative: 0.0 1.0; to_x:"right_pad";}
}
}
+ part {
+ name : "playlist_list_content";
+ type: SWALLOW;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "padding.left"; offset: 0 40;}
+ rel2 { relative: 0.0 1.0; to: "padding.right"; }
+ }
+ description {
+ state: "fastscroll.visible" 0.0;
+ rel1 { relative: 1.0 0.0; to: "padding.left"; offset: 0 40;}
+ rel2 { relative: 0.0 1.0; to: "padding.right"; }
+ }
+ }
part {
name : "track_list_content";
type: SWALLOW;
target : "list_content";
}
program { name: "edit_view";
- signal: "edit_signal";
- source: "edit_source";
- action: STATE_SET "edit" 0.0;
- target: "track_list_content";
- }
+ signal: "edit_signal";
+ source: "edit_source";
+ action: STATE_SET "edit" 0.0;
+ target: "track_list_content";
+ }
+ }
+}
+
+group { name : "playlist_control_layout";
+ parts {
+ part { name : "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part { name : "label_part";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0/40; to: "bg";}
+ rel2 { relative: 500/1200 26/40; to: "bg"; }
+ color: 0 0 0 0;
+ }
+ }
+ part { name : "label_part_swallow";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0.5;
+ rel1 { relative: 0.0 0.0; to: "label_part";}
+ rel2 { relative: 1.0 1.0; to: "label_part"; }
+ }
+ }
+ part { name : "create_playlist_part";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0;
+ rel1 { relative: 1168/1200 5.5/32; to: "bg";}
+ rel2 { relative: 1194/1200 26.5/32; to: "bg"; }
+ color: 0 0 0 0;
+ }
+ }
+ part { name : "create_playlist_part_swallow";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0;
+ rel1 { relative: 0.0 0.0; to: "create_playlist_part";}
+ rel2 { relative: 1.0 1.0; to: "create_playlist_part"; }
+ }
+ }
}
}
rel2 { relative: 1.0 1.0; to: "label_part"; }
}
}
- part { name : "shuffle_part";
- type: RECT;
- scale: 1;
+ part { name : "shuffle_part";
+ type: RECT;
+ scale: 1;
description {
state: "default" 0.0;
- align: 0 0;
- rel1 { relative: 1108.51/1200 4/40; to: "bg";}
+ align: 0 0;
+ rel1 { relative: 1108.51/1200 4/40; to: "bg";}
rel2 { relative: 1132.51/1200 28/40; to: "bg"; }
color: 0 0 0 0;
}
}
- part { name : "shuffle_part_swallow";
- type: SWALLOW;
- scale: 1;
+ part { name : "shuffle_part_swallow";
+ type: SWALLOW;
+ scale: 1;
description {
state: "default" 0.0;
- align: 0 0;
+ align: 0 0;
rel1 { relative: 0.0 0.0; to: "shuffle_part";}
rel2 { relative: 1.0 1.0; to: "shuffle_part"; }
}
}
- part { name : "play_all_part";
- type: RECT;
- scale: 1;
- description {
+ part { name : "play_all_part";
+ type: RECT;
+ scale: 1;
+ description {
state: "default" 0.0;
- align: 0 0;
- rel1 { relative: 1168/1200 6.5/40; to: "bg";}
+ align: 0 0;
+ rel1 { relative: 1168/1200 6.5/40; to: "bg";}
rel2 { relative: 1194/1200 27.5/40; to: "bg"; }
color: 0 0 0 0;
}
}
- part { name : "play_all_part_swallow";
- type: SWALLOW;
- scale: 1;
+ part { name : "play_all_part_swallow";
+ type: SWALLOW;
+ scale: 1;
description {
state: "default" 0.0;
- align: 0 0;
+ align: 0 0;
rel1 { relative: 0.0 0.0; to: "play_all_part";}
rel2 { relative: 1.0 1.0; to: "play_all_part"; }
}
#include "mp-edit-playlist.h"
#include "ms-key-ctrl.h"
-static void _mp_all_view_playlist_list_create_playlist_cb(void *data,
- Evas_Object *
- obj,
- void
- *event_info);
static void _mp_all_view_edit_cb(void *data, Evas_Object * obj,
void *event_info);
static void _mp_all_view_content_load(void *thiz, MpTab_e tab);
}
-static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object * obj,
+void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object * obj,
void *event_info)
{
eventfunc;
}
/*************** functions for playlist list update *******************/
-static void _mp_all_view_playlist_list_create_playlist_cb(void *data,
+void _mp_all_view_playlist_list_create_playlist_cb(void *data,
Evas_Object *
obj,
void *event_info)
Mp_Playlist_Data *mp_playlist_data =
mp_edit_playlist_create(MP_PLST_CREATE_TO_ADD_TRACK);
- mp_edit_playlist_content_create(mp_playlist_data);
+ if(!mp_playlist_data) {
+ DEBUG_TRACE("mp_playlist_data is NULL");
+ } else {
+ DEBUG_TRACE("mp_playlist_data is not NULL");
+ mp_edit_playlist_content_create(mp_playlist_data);
+ DEBUG_TRACE("after mp_edit_playlist_content_create");
+ }
}
int _mp_all_view_update_options(void *thiz)
MpAllView_t *view = (MpAllView_t *) thiz;
MP_CHECK_VAL(view->navi_it, -1);
+ Evas_Object *back_button = elm_button_add(view->all_view_layout);
+ elm_object_style_set(back_button, "naviframe/end_btn/default");
+ elm_object_item_part_content_set(view->navi_it, "prev_btn",
+ back_button);
+ /*evas_object_smart_callback_add(back_button, "clicked",
+ _mp_all_view_normal_more_btn_cb, view);*/
+ elm_naviframe_item_pop_cb_set(view->navi_it,
+ _mp_all_view_pop_cb, view);
+
PROFILE_IN("mp_view_clear_options");
mp_view_clear_options((MpView_t *) view);
PROFILE_OUT("mp_view_clear_options");
#include "mp-play.h"
#include "mp-edit-playlist.h"
#include "ms-key-ctrl.h"
+#include "mp-all-view.h"
#define ALBUM_GRID_W 233
#define ALBUM_GRID_H 319
text = g_strdup_printf(GET_STR(STR_MP_PD_SONGS), count);
}
- format_text = g_strdup_printf("%s | %s", text, time);
+ format_text = g_strdup_printf("%s", text);
IF_FREE(text);
return format_text;
}
mp_media_info_group_get_playlist_id(plst, &playlist_id);
- if (!strcmp(part, "elm.icon.1") || !strcmp(part, "elm.swallow.icon")) {
+ if (!strcmp(part, "elm.icon")) {
mp_common_playlist_album_update(plst);
ret = mp_media_info_playlist_get_thumbnail_path(plst, &thumb_path);
mp_retvm_if(ret != 0, NULL, "Fail to get value");
endfunc;
}
-static char *_mp_playlist_genlist_group_index_default_text_get(void *data,
- Evas_Object
- *obj,
- const char
- *part)
-{
- mp_list_item_data_t *item_data = data;
- MP_CHECK_NULL(item_data);
- const char *text = NULL;
- if (!strcmp(part, "elm.text")) {
- if (item_data->index == 0) {
- text = STR_MP_DEFAULT_PLAYLIST_GROUP_TITLE;
- }
- }
- return g_strdup(GET_STR(text));
-}
-
static char *_mp_playlist_genlist_group_index_user_text_get(void *data,
Evas_Object *
obj,
mp_list_item_data_t *item_data = data;
MP_CHECK_NULL(item_data);
const char *text = NULL;
- if (!strcmp(part, "elm.text")) {
- if (item_data->index != 0) {
- text = g_strdup(GET_STR(STR_MP_MY_PLAYLIST_GROUP_TITLE));
- }
- } else if (!strcmp(part, "elm.text.end")) {
- MpPlaylistList_t *list = evas_object_data_get(obj, "list_data");
- MP_CHECK_NULL(list);
- unsigned int count =
- mp_list_get_editable_count((MpList_t *) list,
- mp_list_get_edit_type((MpList_t *)
- list));
- if (item_data->index != 0) {
- if (count <= 0) {
- text = g_strdup(GET_STR(STR_MP_NO_PLAYLISTS));
- } else if (count == 1) {
- text = g_strdup(GET_STR(STR_MP_1_PLAYLIST));
- } else {
- text =
- g_strdup_printf(GET_STR(STR_MP_PD_PLAYLISTS), count);
- }
- }
- }
return text;
}
free(item_data);
}
+static bool genlist_item_have_item_style(Elm_Object_Item *item, const char *style)
+{
+ if (!item) return false;
+ const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(item);
+
+ if (!itc || !itc->item_style || strcmp(itc->item_style, style))
+ return false;
+
+ return true;
+}
+
+bool genlist_item_style_auto_apply_substyle(Elm_Object_Item *item)
+{
+ bool first_in_group = false, last_in_group = false;
+
+ if (!genlist_item_have_item_style(item, "1line") &&
+ !genlist_item_have_item_style(item, "2line") &&
+ !genlist_item_have_item_style(item, "full") &&
+ !genlist_item_have_item_style(item, "multiline"))
+ return false;
+
+ Elm_Object_Item *previous = elm_genlist_item_prev_get(item);
+ Elm_Object_Item *next = elm_genlist_item_next_get(item);
+
+ if (previous) {
+ first_in_group = genlist_item_have_item_style(previous, "group_index");
+ } else
+ first_in_group = true;
+
+ if (next) {
+ last_in_group = genlist_item_have_item_style(next, "group_index");
+ } else
+ last_in_group = true;
+
+ if (first_in_group && last_in_group) {
+ elm_object_item_signal_emit(item, "elm,state,group,single", "elm");
+ } else if (first_in_group) {
+ elm_object_item_signal_emit(item, "elm,state,group,top", "elm");
+ } else if (last_in_group) {
+ elm_object_item_signal_emit(item, "elm,state,group,bottom", "elm");
+ } else {
+ elm_object_item_signal_emit(item, "elm,state,group,middle", "elm");
+ }
+
+ return true;
+}
+
+static void gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = event_info;
+ mp_list_item_data_t *id = elm_object_item_data_get(it);
+ elm_object_item_data_get(it);
+ genlist_item_style_auto_apply_substyle(it);
+}
+
static void _mp_playlist_list_genlist_create(MpPlaylistList_t * list)
{
MP_CHECK(list);
-
+ char *text = NULL;
+ unsigned int count = mp_list_get_editable_count((MpList_t *) list,
+ mp_list_get_edit_type((MpList_t *)
+ list));
/*create new genlist */
list->genlist = mp_widget_genlist_create(list->box);
evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL,
EVAS_HINT_FILL);
elm_genlist_homogeneous_set(list->genlist, EINA_TRUE);
+ evas_object_smart_callback_add(list->genlist, "realized", gl_realized_cb, NULL);
elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS);
evas_object_show(list->genlist);
/*packet genlist to box */
list->itc_auto->func.del = _mp_playlist_list_item_del_cb;
}
- if (!list->itc_group_index_default) {
- list->itc_group_index_default = elm_genlist_item_class_new();
- MP_CHECK(list->itc_group_index_default);
- list->itc_group_index_default->item_style = "group_index";
- list->itc_group_index_default->func.text_get =
- _mp_playlist_genlist_group_index_default_text_get;
- list->itc_group_index_default->func.del =
- _mp_playlist_genlist_group_index_del_cb;
- }
-
if (!list->itc_group_index_user) {
list->itc_group_index_user = elm_genlist_item_class_new();
MP_CHECK(list->itc_group_index_user);
/* load list */
_mp_playlist_list_load_list(thiz, count_auto, count_user);
+ char *text = NULL;
+ unsigned int count = mp_list_get_editable_count((MpList_t *) list,
+ mp_list_get_edit_type((MpList_t *)
+ list));
+ if (count <= 0) {
+ text = g_strdup(GET_STR(STR_MP_NO_PLAYLISTS));
+ } else if (count == 1) {
+ text = g_strdup(GET_STR(STR_MP_1_PLAYLIST));
+ } else {
+ text = g_strdup_printf(GET_STR(STR_MP_PD_PLAYLISTS), count);
+ }
+ elm_object_text_set(list->playlist_count_label, text);
+ MpAllView_t *view = (MpAllView_t *) thiz;
+ MP_CHECK(view);
+ mp_evas_object_del(view->more_btn_ctxpopup);
+ evas_object_smart_callback_add(list->create_playlist_btn, "clicked", _mp_all_view_playlist_list_create_playlist_cb, view);
}
static unsigned int
MP_CHECK_NULL(list);
mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_PLAYLIST);
+ list->playlist_control_layout = mp_common_load_edj(((MpList_t *) list)->layout, MP_EDJ_NAME, "playlist_control_layout");
+ elm_object_part_content_set(((MpList_t *) list)->layout, "control_part", list->playlist_control_layout);
+ evas_object_show(list->playlist_control_layout);
+
list->get_count = _mp_playlist_list_get_count;
list->update = _mp_playlist_list_update;
list->bottom_counter_text_get_cb =
_mp_playlist_list_bottom_counter_text_get_cb;
+ list->playlist_count_label = elm_label_add(list->playlist_control_layout);
+ elm_object_text_set(list->playlist_count_label, "check");
+ elm_object_part_content_set(list->playlist_control_layout, "label_part_swallow", list->playlist_count_label);
+ evas_object_show(list->playlist_count_label);
+
+ list->create_playlist_btn = elm_button_add(list->playlist_control_layout);
+ Evas_Object *img_play_all = elm_image_add(list->create_playlist_btn);
+ char buffer[1024] = {0,};
+ const char *path = app_get_resource_path();
+ MP_CHECK_NULL(path);
+ snprintf(buffer, 1024, "%s%s%s", path, "images/", "create_playlist.png");
+ elm_image_file_set(img_play_all, buffer, NULL);
+
+ evas_object_size_hint_min_set(img_play_all, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10));
+ evas_object_size_hint_max_set(img_play_all, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10));
+ elm_object_part_content_set(list->create_playlist_btn, "icon", img_play_all);
+
+ elm_object_style_set(list->create_playlist_btn, "focus");
+ elm_object_part_content_set(list->playlist_control_layout, "create_playlist_part_swallow", list->create_playlist_btn);
+ evas_object_show(list->create_playlist_btn);
+ evas_object_show(list->playlist_control_layout);
+
list->update(list);
+ free(path);
return list;
}