From: Minkyu Kang Date: Tue, 4 Aug 2015 08:12:09 +0000 (+0900) Subject: mplyaer: add favorite icon at list X-Git-Tag: accepted/tizen/tv/20150804.235436~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F45263%2F1;p=profile%2Ftv%2Fapps%2Fnative%2Fair_mediahub.git mplyaer: add favorite icon at list Change-Id: Ie6d5a2e6f330e2d27a3241225f66596e8ad4544b Signed-off-by: Minkyu Kang --- diff --git a/include/define.h b/include/define.h index 78fab27..4359270 100644 --- a/include/define.h +++ b/include/define.h @@ -56,6 +56,7 @@ /* part */ #define PART_ELM_TEXT_TITLE "elm.text.title" +#define PART_ELM_TEXT_TITLE2 "elm.text.title2" #define PART_ELM_TEXT_ARTIST "elm.text.artist" #define PART_ELM_TEXT_ALBUM "elm.text.album" #define PART_ELM_TEXT_PLAYTIME "elm.text.playtime" diff --git a/include/view/mplayer.h b/include/view/mplayer.h index 94d9897..eab576b 100644 --- a/include/view/mplayer.h +++ b/include/view/mplayer.h @@ -46,6 +46,7 @@ /* images */ #define IMAGE_MUSIC_THUMBNAIL IMAGEDIR"/ic_thumbnail_song_player.png" +#define IMAGE_MUSIC_LIST_FAVORITE IMAGEDIR"/ic_music_list_favorite.png" #define IMAGE_MUSIC_PREV_FOCUS "btn_music_contr_previous_foc.png" #define IMAGE_MUSIC_PREV_NORMAL "btn_music_contr_previous_nor.png" diff --git a/res/edc/widgets/genlist.edc b/res/edc/widgets/genlist.edc index 7309809..8ac6183 100644 --- a/res/edc/widgets/genlist.edc +++ b/res/edc/widgets/genlist.edc @@ -18,8 +18,8 @@ group { name: "elm/genlist/item/music_list/default"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; - data.item: "texts" "elm.text.title elm.text.artist elm.text.playtime"; - data.item: "contents" "elm.swallow.icon"; + data.item: "texts" "elm.text.title elm.text.title2 elm.text.artist elm.text.playtime"; + data.item: "contents" "elm.swallow.favorite"; data.item: "focus_highlight" "on"; images { image: IMAGE_MUSIC_LIST_PLAY COMP; @@ -32,7 +32,8 @@ group { scale: 1; description { state: "default" 0.0; - min: 0 140; + min: 960 140; + align: 0.0 0.0; color: COLOR_LIST_BG; } description { @@ -179,21 +180,6 @@ group { fixed: 1 1; align: 0.0 0.0; } - description { - state: "default" 0.1; - inherit: "default" 0.0; - min: 130 140; - rel1 { - to: "right_padding"; - relative: 1.0 0.0; - } - rel2 { - to: "right_padding"; - relative: 1.0 0.0; - } - align: 0.0 0.0; - fixed: 1 1; - } } part { name: PART_ELM_TEXT_PLAYTIME; @@ -226,8 +212,8 @@ group { } } part { - name: PART_ELM_TEXT_TITLE; - type: TEXT; + name: "title_area"; + type: RECT; scale: 1; description { state: "default" 0.0; @@ -240,6 +226,26 @@ group { to: PART_ELM_TEXT_PLAYTIME; relative: 0.0 0.0; } + fixed: 0 1; + align: 0.0 0.0; + visible: 0; + } + } + part { + name: PART_ELM_TEXT_TITLE; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + min: 0 68; + rel1 { + to: "title_area"; + relative: 0.0 0.0; + } + rel2 { + to: "title_area"; + relative: 1.0 0.0; + } text { font: FONT_LIGHT; size: 36; @@ -256,6 +262,28 @@ group { } } part { + name: PART_ELM_TEXT_TITLE2; + inherit: PART_ELM_TEXT_TITLE; + description { + state: "default" 0.0; + max: 740 68; + rel2 { + to: "title_area"; + relative: 0.0 0.0; + } + text { + min: 1 0; + ellipsis: -1; + } + visible: 0; + } + description { + state: "default" 0.1; + inherit: "default" 0.0; + max: 668 0; + } + } + part { name: PART_ELM_TEXT_ARTIST; type: TEXT; scale: 1; @@ -263,11 +291,11 @@ group { state: "default" 0.0; min: 0 44; rel1 { - to: PART_ELM_TEXT_TITLE; + to: "title_area"; relative: 0.0 1.0; } rel2 { - to: PART_ELM_TEXT_TITLE; + to: "title_area"; relative: 1.0 1.0; } text { @@ -285,6 +313,44 @@ group { color: COLOR_TEXT_FOCUS; } } + part { + name: "padding_favorite"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + min: 10 28; + rel1 { + to: PART_ELM_TEXT_TITLE2; + relative: 1.0 0.0; + } + rel2 { + to: PART_ELM_TEXT_TITLE2; + relative: 1.0 0.0; + } + fixed: 1 1; + align: 0.0 0.0; + } + } + part { + name: PART_ELM_SWALLOW_FAVORITE; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + min: 36 36; + rel1 { + to: "padding_favorite"; + relative: 1.0 1.0; + } + rel2 { + to: "padding_favorite"; + relative: 1.0 1.0; + } + fixed: 1 1; + align: 0.0 0.0; + } + } } script { public focus_status = 0; @@ -337,7 +403,7 @@ group { action: STATE_SET "default" 0.1; target: "image_padding"; target: "image_bg"; - target: "time_padding"; + target: PART_ELM_TEXT_TITLE2; transition: TRANSITION_SHOW_ICON; after: "select,image"; } @@ -365,7 +431,7 @@ group { action: STATE_SET "default" 0.0; target: "image_padding"; target: "image_bg"; - target: "time_padding"; + target: PART_ELM_TEXT_TITLE2; transition: TRANSITION_SHOW_ICON; } } diff --git a/res/images/ic_music_list_favorite.png b/res/images/ic_music_list_favorite.png new file mode 100644 index 0000000..2df7931 Binary files /dev/null and b/res/images/ic_music_list_favorite.png differ diff --git a/src/view/mplayer.c b/src/view/mplayer.c index 5090190..6062725 100644 --- a/src/view/mplayer.c +++ b/src/view/mplayer.c @@ -507,7 +507,8 @@ static char *_list_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } - if (!strcmp(part, PART_ELM_TEXT_TITLE)) { + if (!strcmp(part, PART_ELM_TEXT_TITLE) || + !strcmp(part, PART_ELM_TEXT_TITLE2)) { snprintf(buf, sizeof(buf), "%02d. %s", index, mi->title); } else if (!strcmp(part, PART_ELM_TEXT_ARTIST)) { snprintf(buf, sizeof(buf), "%s / %s", @@ -521,6 +522,41 @@ static char *_list_text_get(void *data, Evas_Object *obj, const char *part) return strdup(buf); } +static Evas_Object *_list_content_get(void *data, + Evas_Object *obj, const char *part) +{ + struct _list_data *ld; + app_media_info *mi; + Evas_Object *image; + + if (!data) + return NULL; + + ld = data; + + mi = app_media_get_info(ld->am); + if (!mi) { + _ERR("failed to get media info"); + return NULL; + } + + image = NULL; + if (!strcmp(part, PART_ELM_SWALLOW_FAVORITE)) { + if (!mi->favorite) + return NULL; + + image = util_add_image(obj, IMAGE_MUSIC_LIST_FAVORITE); + if (!image) { + _ERR("failed to create image object"); + return NULL; + } + + evas_object_show(image); + } + + return image; +} + static void _list_selected(int id, void *data, Evas_Object *obj, Elm_Object_Item *it) { @@ -617,7 +653,7 @@ static void _add_playlist_item(struct _priv *priv) ic->item_style = STYLE_MPLAYER_LIST; ic->func.text_get = _list_text_get; - ic->func.content_get = NULL; + ic->func.content_get = _list_content_get; ic->func.state_get = NULL; ic->func.del = _list_item_del;