From b1a097e4c7652bf2b0d75127251613fa4328c4fc Mon Sep 17 00:00:00 2001 From: "bhutani.92" Date: Wed, 3 May 2017 11:44:18 +0530 Subject: [PATCH] [Tizen 4.0] Recently Added Grid addition in Tracks/Albums/Artist Change-Id: I9f231be9f07a92ede9fb1fc5dbd25e97f0561a97 Signed-off-by: bhutani.92 --- .../music_player/recently_added/alltracks_bg.png | Bin 0 -> 3117 bytes inc/mp-common-defs.h | 7 + inc/mp-images.h | 11 +- music-chooser/src/mc-common.c | 7 +- music-chooser/tizen-manifest.xml | 121 ++-- res/edje/genlist/genlist_normal.edc | 439 ++++++++++++++ res/edje/mp-all-view.edc | 21 + res/edje/mp-images.edc | 48 -- shared/res/shared_images/alltracks_pause_icon.png | Bin 0 -> 1491 bytes shared/res/shared_images/alltracks_play_icon.png | Bin 0 -> 1618 bytes src/common/include/mp-common.h | 2 + src/common/mp-app.c | 1 + src/common/mp-common.c | 114 +++- src/common/mp-edit-callback.c | 11 +- src/core/mp-lyric-mgr.c | 2 +- src/core/mp-playlist-mgr.c | 16 +- src/core/mp-setting-ctrl.c | 12 +- src/core/mp-view-mgr.c | 17 +- src/include/music.h | 6 +- src/mp-main.c | 14 + src/view/mp-add-track-view.c | 12 +- src/view/mp-album-detail-view.c | 20 +- src/view/mp-all-view.c | 2 + src/view/mp-edit-view.c | 8 +- src/view/mp-player-view.c | 6 +- src/view/mp-select-track-view.c | 6 +- src/widget/include/mp-album-list.h | 1 - src/widget/include/mp-artist-list.h | 1 + src/widget/include/mp-list.h | 3 + src/widget/include/mp-track-list.h | 1 - src/widget/mp-album-detail-list.c | 15 +- src/widget/mp-album-list.c | 553 +++++++++++++++++- src/widget/mp-artist-detail-list.c | 10 +- src/widget/mp-artist-list.c | 642 ++++++++++++++++++--- src/widget/mp-lyric.c | 1 + src/widget/mp-playlist-list.c | 41 +- src/widget/mp-track-list.c | 416 +++++++++++-- 37 files changed, 2182 insertions(+), 405 deletions(-) create mode 100644 images/music_player/recently_added/alltracks_bg.png create mode 100644 shared/res/shared_images/alltracks_pause_icon.png create mode 100644 shared/res/shared_images/alltracks_play_icon.png diff --git a/images/music_player/recently_added/alltracks_bg.png b/images/music_player/recently_added/alltracks_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..6d2a5a0ce8196bd692411ab740188213edaaa7bd GIT binary patch literal 3117 zcmcguS5y;P7QG14n^Xbu(MtqEM>-_*DiBNnl};!kpeRj{(AxtM=>|ci7ZEfV0i}0> zfYeZ=3kc4m7?hI1nR#o?a?SUAoU`}cYu$bBIp^mlUa>G_qUWUt05BOF=~i%e&vd%U!dO|Pd|SFV>n#E|F)lp*G+c- zf~T=IXoSr=mnLa$4`!MW`PkIYnv+(*8kQW%kuC-iq+>Nn5GQ zIqc%O&(Yl-T?@-HIv9Epf51vx?)dA7bOVB+?P0% zozFPu>BzK&1y zun-tAd?E#{=Z#dSj`TfwCb~`Kd4r+wE-Bfgjz#AUC|sXL?)v|ljegNX{M6LS^75of z2h72_4;g-fZgXrw9^d>Cp>ago|NMSY1S5YPV@P%Ixou$2toXvvBf1!unbkDIqXq`@ z5&x)Ahp`JD1>sn-Vhc#s%S+jnFBVFKJ(BDc9U;3d&PyFqYRxNwT5m0iuypCN>#mgF zO~qMJfh~(90CpPvT0cq9Qbu}4FAN2dziA&E7K(yM593Dx0Nl_MkwNs;Yj@KEpjU{2 z)avr>wVs!1p}x?1cBYl#$VoW{CeqOcV};SXMP9h=Bv};&lZYFv<%c*yKk4u*wpe+_ zW%x78wAsF8*7Rrj=}cSDD$#_Yqtfl6Wp@^wPM~l}LJ6nRa_7b#2(}tgu_cQL^d@jv z37MuV8Od2EAp~rV_;)mKpHYp!X7Dauy$8rg9mO>n%00%^S!sS^d;`aqsqn@aJY)Fi z7ATjO##NaA@%C$8%@pOLwU3paEYoRP@NU_bFXw3#I&R9!bhX1?U6!KDaP5C3RK-}? z#anx|in1|r-*xC!5EUCnzlBbjDhMXvd{Ng3WrnhtG%6FgAfk9~nofm|GRCS+TqvW= z^tIT#b3Z!HyU5GMql~14$Jx@@p{!vE@D3FbwnVtRIR4=o<5w>bBWxoEBe$%D*QLty z6^(d>GkT}peClXaA4>^b>WN*(F1If$Eb}c3?l{n6U33Co9M~*MSoe9G@T{<|D6UYu z=g8~YKF_nBEh|EtQ%bXkRTtr`Us}bNu`AxqQyq-vGBz!)ewI1P>&fj&@_P9t@ZGuD z%!?M;ACV*d>xN&lzfkT4F*3z*Mt3KmC3y1B)0{{11f74GV^+d5n#|LUkX4b}%vsB2 z$@Q~EL2!`!oaue^nI@THnS2l^qP(J{Vy=S0cGtEakyd`gCcMVLR>5YeobFRrrELZF z%BBsU4Z2*tEWQF==7-RJ5n*?nNNv|{)@})ZVO99bajB_GfWeigK3Gc7hp95|E=H+C z?A74Z{dJ13%WIl((K)cq&bdnl8cgj zC5mQvIrnQm6{!skUDuQ{hw0SJbE%^x;(Yd5un`06z_WXgBdMEBN(x9eA;GrgQc}Oges8h~cHu@hbk?+QXEbMozYG8KSd)e+eu}x0-=06>&gRR07N@3369Qqb@W{LZ}IPrWR?xqP&o zrRqy*6D5dNg^ahxw8}fhciLSt9(Ds`C@jkOrs)M$8Ay%tt())XkG6K>7qN>BOJUqO z(4Oo5Aw`6?z1UK&av3%$wJaU81dGd$|DnqYDdS2J-C++BO{EWM<8MO?L5G!x6DHx; zAQvrmj3DNrkG`fiDTRo1Dilkt;A6zgA2yjWna$>_6>#O<6Y!PSRBM)tew6+&09GMr zo`FMepjSQa^;fya)}3_TN^XE&%%th{sef2?)=rup2P^r4u$P#C(A1&bkscog6Z=%N zDhnIjbUjHJkYs)7129runO{ zxAwp56QS9I62!)69321rgT~t?_tIX%pt?5V1!52J6QR64GW*7P;^5ZsHeXoNcg3$` zM29BQu~zSUqAi83`IyI;`=Rk+JxRMJv10uo>(KXlwS{lMRyXAcJ7`=$ur2e$vbp#ad>Arpfx zT6Q-+Y0Rs^U-Q9lhc>?n^B}GB6{rwq_nJfg;v$ca6{u>?Ht&Y|kvd8H^IWqLx5bYM z{f$#W;@j0tmQ9X(I$OF^@Y(n=ZHJSY$!{|cyjy|_cZX*TNz}2?LnrC`X)N%wX}M|r zaZGWW1(&r{RTs5yAFm&k!iU_3#0t1io}Kj9aC1Q;4#qYo2*WwUMcF&q86SM_7awo5 zZ1TJ$cC~d~eBT?aAa`T$>fu&v&`c2jx99ULmdp1A9!QWqf4tha`B-|G!IP0erlQQ* zJ#tl$CZ7H`1ze4+%>f7%1t2mSfFI;jTnFH;EC3r$0I1~v!0q?QvC{wm3Y4*)E+TmP z>xdi^0JM~{^5lZnj2LKnO7-i`0{buZcls}< zf2+UK-~Ioq>Tmx4dCULu|F5e5Z~wo$I#NGf0GUh)Fh&;kkm#bG(<3m}x6rGBIYs>w DxP8c2 literal 0 HcmV?d00001 diff --git a/inc/mp-common-defs.h b/inc/mp-common-defs.h index 6aa48b4..33b6fce 100644 --- a/inc/mp-common-defs.h +++ b/inc/mp-common-defs.h @@ -68,6 +68,10 @@ typedef enum { MMC } storage_mode_e; +//Number of Recently Added Tracks that need to be shown in Tracks/Album/Artist View +#define RECENTLY_ADDED_TRACKS_MAX_COUNT 3 +#define RECENTLY_ADDED_PART_NAME_MAX_SIZE 20 + //1 Do not change default thumbnail path. it's shared by other apps #define DEFAULT_THUMBNAIL "default_album_art_120.png" #define DEFAULT_THUMBNAIL_MIDDLE "default_albumart_middle.png" @@ -75,6 +79,9 @@ typedef enum { #define DEFAULT_PLAYER_THUMBNAIL "default_album_art_480.png" #define BROKEN_ALBUMART_IMAGE_PATH "/opt/usr/share/media/.thumb/thumb_default.png" +#define RECENTLY_ADDED_PLAY_ICON "alltracks_play_icon.png" +#define RECENTLY_ADDED_PAUSE_ICON "alltracks_pause_icon.png" + #define PLAYLIST_CREATE_THUMBNAIL "T02_playlist_thumbnail_created.png" //for shortcut typedef enum { diff --git a/inc/mp-images.h b/inc/mp-images.h index 8675577..026bd66 100644 --- a/inc/mp-images.h +++ b/inc/mp-images.h @@ -19,15 +19,14 @@ #define MORE_BTN_DIR "more icon" #define STORAGE_TYPE_DIR "storage_type" - -#define MP_LITE_PAUSE_ICON "lite/play_list_control_pause.png" -#define MP_LITE_PLAY_ICON "lite/play_list_control_play.png" -#define MP_LITE_SHUFFLE_ICON "lite/Icon/play_icon_shuffle.png" +#define MP_LITE_PAUSE_ICON "lite/play_list_control_pause.png" +#define MP_LITE_PLAY_ICON "lite/play_list_control_play.png" +#define MP_LITE_SHUFFLE_ICON "lite/Icon/play_icon_shuffle.png" #define NOCONTENT_MULTIMEDIA "T02_Nocontents_multimedia.png" -#define THUMBNAIL_MOST_PLAYED ICON_DIRECTORY"/T02_playlist_most_played.png" -#define THUMBNAIL_RECENTLY_PLAYED ICON_DIRECTORY"/T02_playlist_recently_played.png" +#define THUMBNAIL_MOST_PLAYED ICON_DIRECTORY"/T02_playlist_most_played.png" +#define THUMBNAIL_RECENTLY_PLAYED ICON_DIRECTORY"/T02_playlist_recently_played.png" #define THUMBNAIL_RECENTLY_ADDED ICON_DIRECTORY"/T02_playlist_recently_added.png" #define THUMBNAIL_QUICK_LIST ICON_DIRECTORY"/T02_playlist_starred.png" diff --git a/music-chooser/src/mc-common.c b/music-chooser/src/mc-common.c index 7e526f3..3d5e340 100644 --- a/music-chooser/src/mc-common.c +++ b/music-chooser/src/mc-common.c @@ -69,11 +69,9 @@ void mc_common_push_track_view_by_group_name(void *data, int track_type, mc_common_load_edj(ad->navi_bar, mc_edj_path, "view_layout_tabbar"); g_navi_it = elm_naviframe_top_item_get(ad->navi_bar); -// g_ly = elm_object_item_part_content_get(g_navi_it, "elm.swallow.content"); tabbar = _create_tabbar(ad->navi_bar, ad); elm_object_part_content_set(navi_layout, "tabbar", tabbar); -// sub_view = elm_object_part_content_unset(g_ly, "list-content"); track_list = mc_track_list_create(ad->navi_bar, ad); mc_track_list_set_data(track_list, track_type, name, playlist_id); @@ -753,6 +751,7 @@ const char *mc_common_search_markup_keyword(const char *string, Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h) { + char default_thumbnail[1024] = { 0 }; Evas_Object *thumbnail = elm_image_add(obj); if (w == h) { elm_image_prescale_set(thumbnail, w); @@ -762,14 +761,12 @@ Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, if ((!path) || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { - char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); free(shared_path); - path = g_strdup(default_thumbnail); } - elm_image_file_set(thumbnail, path, NULL); + elm_image_file_set(thumbnail, default_thumbnail, NULL); evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/music-chooser/tizen-manifest.xml b/music-chooser/tizen-manifest.xml index 4df6166..5ee8f0b 100644 --- a/music-chooser/tizen-manifest.xml +++ b/music-chooser/tizen-manifest.xml @@ -3,68 +3,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + music-chooser.png + + + + - - http://tizen.org/privilege/mediastorage - http://tizen.org/privilege/externalstorage.appdata - http://tizen.org/privilege/externalstorage - http://tizen.org/privilege/notification - + http://tizen.org/privilege/mediastorage + http://tizen.org/privilege/notification + http://tizen.org/privilege/externalstorage.appdata + http://tizen.org/privilege/externalstorage + diff --git a/res/edje/genlist/genlist_normal.edc b/res/edje/genlist/genlist_normal.edc index 54c0bfc..8b4c4cb 100644 --- a/res/edje/genlist/genlist_normal.edc +++ b/res/edje/genlist/genlist_normal.edc @@ -990,3 +990,442 @@ group {GENLIST_NAME("music/1text/bottom_counter/default"); } } } + +#define IMG_ALBUM_ART_OVERLAY "recently_added/alltracks_bg.png" + +group { + name: "elm/genlist/item/recently_added/default"; + data.item: "texts" "elm.text.main.1 elm.text.sub.1 elm.text.main.2 elm.text.sub.2 elm.text.main.3 elm.text.sub.3"; + data.item: "contents" "elm.swallow.1 elm.swallow.2 elm.swallow.3 elm.swallow.1.play elm.swallow.2.play elm.swallow.3.play"; + + images { + image: IMG_ALBUM_ART_OVERLAY COMP; + } + + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + min: 0 217; + color: 255 255 255 230; + } + } + + part { + name: "elm.swallow.1"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 32/720 0.0; + to: "bg"; + } + rel2 { + relative: 229/720 1.0; + to: "bg"; + } + min: 197 197; + } + } + + part { + name: "elm.swallow.1.overlay"; + type: IMAGE; + scale: 1; + repeat_events: 1; + description { + state: "default" 0.0; + rel1 { + to: "elm.swallow.1"; + } + rel2 { + to: "elm.swallow.1"; + } + image.normal: IMG_ALBUM_ART_OVERLAY; + color: 0 0 0 20; + } + } + + part { + name: "elm.text.main.1"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 111/197; + to: "elm.swallow.1"; + } + rel2 { + relative: 127/197 154/197; + to: "elm.swallow.1"; + } + text { + size: 32; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "elm.text.sub.1"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 154/197; + to: "elm.swallow.1"; + } + rel2 { + relative: 127/197 187/197; + to: "elm.swallow.1"; + } + text { + size: 24; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "play_btn_bg_1"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 137/197 137/197; + to: "elm.swallow.1"; + } + rel2 { + relative: 187/197 187/197; + to: "elm.swallow.1"; + } + min: 50 50; + align: 1.0 1.0; + color: 0 0 0 0; + } + } + + part { + name: "elm.swallow.1.play"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "play_btn_bg_1"; + } + rel2 { + to: "play_btn_bg_1"; + } + color: 168 230 240 100; + } + } + + part { + name: "elm.swallow.2"; + type: SWALLOW; + scale: 1; + repeat_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 261/720 0.0; + to: "bg"; + } + rel2 { + relative: 458/720 1.0; + to: "bg"; + } + min: 197 197; + } + } + + part { + name: "elm.swallow.2.overlay"; + type: IMAGE; + scale: 1; + repeat_events: 1; + description { + state: "default" 0.0; + rel1 { + to: "elm.swallow.2"; + } + rel2 { + to: "elm.swallow.2"; + } + image.normal: IMG_ALBUM_ART_OVERLAY; + color: 0 0 0 20; + } + } + + part { + name: "elm.text.main.2"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 111/197; + to: "elm.swallow.2"; + } + rel2 { + relative: 127/197 154/197; + to: "elm.swallow.2"; + } + text { + size: 32; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "elm.text.sub.2"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 154/197; + to: "elm.swallow.2"; + } + rel2 { + relative: 127/197 187/197; + to: "elm.swallow.2"; + } + text { + size: 24; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "play_btn_bg_2"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 137/197 137/197; + to: "elm.swallow.2"; + } + rel2 { + relative: 187/197 187/197; + to: "elm.swallow.2"; + } + min: 50 50; + align: 1.0 1.0; + color: 0 0 0 0; + } + } + + part { + name: "elm.swallow.2.play"; + type: SWALLOW; + scale: 1; + repeat_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "play_btn_bg_2"; + } + rel2 { + to: "play_btn_bg_2"; + } + color: 168 230 240 100; + } + } + + part { + name: "elm.swallow.3"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 491/720 0.0; + to: "bg"; + } + rel2 { + relative: 688/720 1.0; + to: "bg"; + } + min: 197 197; + } + } + + part { + name: "elm.swallow.3.overlay"; + type: IMAGE; + scale: 1; + repeat_events: 1; + description { + state: "default" 0.0; + rel1 { + to: "elm.swallow.3"; + } + rel2 { + to: "elm.swallow.3"; + } + image.normal: IMG_ALBUM_ART_OVERLAY; + color: 0 0 0 20; + } + } + + part { + name: "elm.text.main.3"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 111/197; + to: "elm.swallow.3"; + } + rel2 { + relative: 127/197 154/197; + to: "elm.swallow.3"; + } + text { + size: 32; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "elm.text.sub.3"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 10/197 154/197; + to: "elm.swallow.3"; + } + rel2 { + relative: 127/197 187/197; + to: "elm.swallow.3"; + } + text { + size: 24; + align: 0.0 0.5; + } + color: 255 255 255 204; + } + } + + part { + name: "play_btn_bg_3"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + relative: 137/197 137/197; + to: "elm.swallow.3"; + } + rel2 { + relative: 187/197 187/197; + to: "elm.swallow.3"; + } + min: 50 50; + align: 1.0 1.0; + color: 0 0 0 0; + } + } + + part { + name: "elm.swallow.3.play"; + type: SWALLOW; + scale: 1; + repeat_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "play_btn_bg_3"; + } + rel2 { + to: "play_btn_bg_3"; + } + color: 168 230 240 100; + } + } + } + + programs { + program { + signal: "mouse,down,1"; + source: "*"; + action: STATE_SET "pressed" 0.0; + target: "elm.swallow.1"; + target: "elm.swallow.1.play"; + target: "elm.swallow.2"; + target: "elm.swallow.2.play"; + target: "elm.swallow.3"; + target: "elm.swallow.3.play"; + } + program { + signal: "mouse,up,1"; + source: "*"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.1"; + target: "elm.swallow.1.play"; + target: "elm.swallow.2"; + target: "elm.swallow.2.play"; + target: "elm.swallow.3"; + target: "elm.swallow.3.play"; + } + + program { + name: "thumbnail_clicked_1"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + program { + name: "play_clicked_1"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + + program { + name: "thumbnail_clicked_2"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + program { + name: "play_clicked_2"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + + program { + name: "thumbnail_clicked_3"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + program { + name: "play_clicked_3"; + source: "*"; + action: SIGNAL_EMIT "mouse,clicked,1" "0.0"; + } + } +} diff --git a/res/edje/mp-all-view.edc b/res/edje/mp-all-view.edc index ca618b1..d4f723a 100644 --- a/res/edje/mp-all-view.edc +++ b/res/edje/mp-all-view.edc @@ -200,6 +200,27 @@ group { name: "shortcut_box"; } } +group { + name: "recently_added_layout"; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + min: 100 100; + color: 255 0 0 255; + } + } + } +} + group { name: "shortcut_layout"; parts { part { name: "bg"; diff --git a/res/edje/mp-images.edc b/res/edje/mp-images.edc index 491b0ca..a9ba6cc 100644 --- a/res/edje/mp-images.edc +++ b/res/edje/mp-images.edc @@ -65,32 +65,19 @@ collections { base_scale: 2.4; -//RESOURCE_IMAGE_LOSSY(MP_ICON_COVERFLOW_BG); -//RESOURCE_IMAGE_LOSSY(MP_ICON_COVERFLOW_SHADOW_BG); RESOURCE_IMAGE(MP_ICON_STORAGE_PHONE); RESOURCE_IMAGE(MP_ICON_STORAGE_MEMORY); RESOURCE_IMAGE(MP_ICON_STORAGE_EXTERNAL); -//RESOURCE_IMAGE(MP_ICON_SQUARE_CELL_NORMAL); -//RESOURCE_IMAGE(MP_ICON_SQUARE_CELL_SELECTED); -//RESOURCE_IMAGE(MP_ICON_SQUARE_CELL_NORMAL_LD); -//RESOURCE_IMAGE(MP_ICON_SQUARE_CELL_SELECTED_LD); RESOURCE_IMAGE(MP_ICON_VOLUME_MIN); RESOURCE_IMAGE(MP_ICON_VOLUME_MAX); RESOURCE_IMAGE(MP_ICON_HEADSET_PATH); RESOURCE_IMAGE(MP_ICON_SPEAKER_PATH); -//RESOURCE_IMAGE(MP_ICON_NEARBY_DMR); -//RESOURCE_IMAGE(MP_ICON_NEARBY_DMR_PRESS); RESOURCE_IMAGE(MP_ICON_MINI_PLAYER); -//RESOURCE_IMAGE(MP_ICON_VIDEO_PLAY); -//RESOURCE_IMAGE_LOSSY(MP_ICON_TURNOVER_01); -//RESOURCE_IMAGE_LOSSY(MP_ICON_TURNOVER_02); -//RESOURCE_IMAGE_LOSSY(MP_ICON_TURNOVER_03); RESOURCE_IMAGE(MP_ICON_PLAY_LIST_PATH); RESOURCE_IMAGE(MP_ICON_BT_HEADSET_PATH); RESOURCE_IMAGE(MP_ICON_SELECT_ALL); RESOURCE_IMAGE(MP_ICON_SEARCH); RESOURCE_IMAGE(MP_ICON_PLUS); -//RESOURCE_IMAGE(MP_ICON_FIND_TAG); RESOURCE_IMAGE(MP_ICON_BACK); RESOURCE_IMAGE(MP_ICON_APP_MUSIC); RESOURCE_IMAGE(MP_PLAYER_MORE_BTN_SAVE_PLAYLIST); @@ -108,7 +95,6 @@ RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_ADD); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_ADD_TO_HOME); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_CHANGE_AXIS); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_CONN_INFO); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_UPDATE_ALBUMART); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_DEVICES); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_DOWNLOAD); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_DELETE_IMAGE); @@ -116,19 +102,13 @@ RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_RENAME_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_CREATE_PLAYLIST_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_DETAIL_IMAGE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_HOMESYNC_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_MORE_THUMBNAIL_VIEW_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_MORE_LIST_VIEW_IMAGE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_MAKE_AVAILABLE_OFFLINE_IMAGE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_GROUP_PLAY_IMAGE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_EDIT_IMAGE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_EDIT); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_FOLDER_VIEW); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_GO_TO_LIB); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_HELP); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_HIDE_MUSIC_VIEW); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_LIB_UPDATE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_MAKE_AVAILABLE_OFFICE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SQUARE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_OPEN_PLAYLIST); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_PLAYLIST); @@ -136,40 +116,12 @@ RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_REFRESH); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SEARCH); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SET_AS); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SETTING); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SHARE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SHARE_VIA); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SHOW_MUSIC_VIEW); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SIGN); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_SUPPORT); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_UPDATE); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_UPLOAD_FROM_DEVICE); -//RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_VIEW); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_VIEW_END); RESOURCE_IMAGE_RECT(MP_PLAYER_MORE_BTN_VIEW_AS); -//RESOURCE_IMAGE(MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE); -//RESOURCE_IMAGE(MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE); - - -//RESOURCE_IMAGE_LOSSY(MP_ICON_CONNECTED_MY_DEVICE); -//RESOURCE_IMAGE_LOSSY(MP_ICON_CONNECTED_TV); - -//RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_TV_ITEM); -//RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_BD_ITEM); -//RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_LFD_ITEM); -//RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_STB_ITEM); -/*RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_MOBILE_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_TABLET_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_DONGLE_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_CAMERA_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_CAMCORDER_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_REF_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_AC_WALL_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_WM_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_ROBOT_TV_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_PC_ITEM); -RESOURCE_IMAGE(MP_PLAY_ALLSHARE_DEVICE_UNKNOWN_ITEM); -RESOURCE_IMAGE_RECT(MP_PLAY_UHA_ICON); -*/ RESOURCE_IMAGE(MP_ICON_NO_ITEM); RESOURCE_IMAGE(MP_MINI_REPEAT_1_ICON); RESOURCE_IMAGE(MP_MINI_REPEAT_ONCE_ICON); diff --git a/shared/res/shared_images/alltracks_pause_icon.png b/shared/res/shared_images/alltracks_pause_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1332679d8d6e7eba1c06477b8100a0cb021a7de3 GIT binary patch literal 1491 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2nC-$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%u1Od5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|81#=KlDb#X~hD#E>34K5C;EJ)Q4 zN-fSWElLJPT$(b-ssbzLqSVBa{GyQj{2W*)24v)yb8$2`G;}qybaORyG2=9ZF3nBND}m`vLFhHdsTY(KatnYqyQCInmZhe+73JqDfW2&$iQ6qEIL(9V zO~LIJQ=EGBfsWA!MJ!T8!-RmT2gHOYTObFX@Kf`Esl5o8tY==In#;hz7*cWT z%}jqkCPR^9-Sr6z-CWFfDCC43VodR6`Y3R(VJau5blD-+BdzlqtR*~S9y5x>YI1IH zI=+D0&7*c|y3tGypXHbRj#i%3S3K);yZ>CtuYKZ+rc83}P~D^;$idm-(ItBF?|MZY zJAt>YE)6yln2ioFZb;qzOtgYwmILz+wzhda=eET=PC8(DVfmkn$EznV`Yf>1l4}m5 znkc{U@2*v1lUS{;{C<&e->YQ~gR+*sn?+lQqUb6;txYXcR{YYioEv}Q;X=di=%Z|4UmI9x8ep}g(>GKc-X=1x*f z%xVp}3VE5`$+H-?i4?sadt(YVV~{y$8WY=I9#)I6Tj1`BaO?y%FdaV8M^Rv1g}rd zxlK;tO&#k_ZED(jA^7tKAYOc7aqP>pE2ZD7+_?FMWAAe3g#Xj`+&?h+knYSKzr&9# zPFgYDY1vE(`=9@FVdQ&MBb@ E0AJW9l>h($ literal 0 HcmV?d00001 diff --git a/shared/res/shared_images/alltracks_play_icon.png b/shared/res/shared_images/alltracks_play_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b1d6915eb82aae59270015d573e6af413bd96452 GIT binary patch literal 1618 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2nC-$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%xRe+5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8KW+g=7RhMR$W{Yl!|Z$R@KEJl?AE#L8-<0 zrA5iW_()TRX$FQJev3c~fv&OgFUkZ)N@9*nesXDUYF>$_i>(q+MlU5Z#md#t)YQn) z(!kZi$;H*o(9p@n%*e^W(#*uk+``$_%m`)%HoYc>uFgh|h6X^LmWGC|W|q#bj!sUF zZjP>I=FU#e7BIb@dBr7(dC93TdozLdLi8HA;ni#9T$Gwvl3x^(pPvIu0Rb8LCHch} z`2`Bj!Db2?;hA|U`Q^o$py+}4)+Mzlvn(~mttdZN0UW+onON+1H6rA1h~5-(!b~6N z7=2LUKuRnyAz%swG2uxc$bn~`)I4C0DFSAVHH6(;)Hi2+w{?yF38$9(?&eB6n15B|>B@dJnOWBBcPSNa;67I4x3uq| z$q%*NO5KbG4=>p2oLc8G<=*)S2cbL8RcB`{(w;QYWFw>4fq7}lhP%`shHL9uKIGrP z`RstuicFKq(+nqt%-O;kc95rn)z3u2^OS^VMpf7T1Ih*5dxB-O6|-8xOV>Rs|HHh4 zS+3#zq~sm8qRZ8lAGay-^G{s=^5ip7Fpgg3VlI{rc`T z9?r!#p3GXVvu#PjqHF7gjWx2~W*8YT#x;HavT=2WyV{>H5%s-3KLzhUl+Vs$3rp#l zqN+Zd<@*8m4T~&$rvHDvWTU5iT0n@D$fo~O53TZTy&8V=P*?m9C5F`>YbJ0`e0Dhf zSI6HA{#kZcLT2;tss1=2%6Qw=g*)5x&c!8L-=A1)CvnnJt}5zoNywVis0}w#by|FL z4kov*ViXRYeVl7AyRB<45Zm)rF_nLLwpIGQtBv_?@4d@!U$HGbzf!$o*@m|zyMO1G zgmzi=e#uUnbM1eplaylist_mgr); + ad->recentlyAddedGridView = true; bool current_removed = false; bool next_play = false; diff --git a/src/common/mp-common.c b/src/common/mp-common.c index 3087e81..d58c6b1 100644 --- a/src/common/mp-common.c +++ b/src/common/mp-common.c @@ -1060,6 +1060,84 @@ void mp_common_show_player_view_after_play() endfunc; } +void mp_common_play_track_list_with_song_uid(mp_list_item_data_t* item, Evas_Object *genlist, + char *item_uid, char *item_uri) +{ + startfunc; + MP_CHECK(item); + MP_CHECK(item_uid); + MP_CHECK(item_uri); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + ad->hide_player_view = true; + ad->paused_by_user = false; + + if (!ad->playlist_mgr) { + mp_common_create_playlist_mgr(); + } + + PROFILE_IN("mp_playlist_mgr_clear"); + mp_playlist_mgr_clear(ad->playlist_mgr); + PROFILE_OUT("mp_playlist_mgr_clear"); + + Elm_Object_Item *gli2 = NULL; + mp_plst_item* plst_item = NULL; + gli2 = elm_genlist_first_item_get(genlist); + while (gli2) { + if (elm_genlist_item_select_mode_get(gli2) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(gli2); + if (item_data + && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { + if (item_data->group_type == MP_GROUP_NONE + || item_data->group_type == MP_GROUP_BY_ALLSHARE) { + char *uri = NULL; + char *uid = NULL; + char *title = NULL; + char *artist = NULL; + + mp_track_type track_type = MP_TRACK_URI; + mp_media_info_get_media_id(item_data->handle, &uid); + if (g_strcmp0(item_uid, uid)) { + gli2 = elm_genlist_item_next_get(gli2); + continue; + } + mp_media_info_get_file_path(item_data->handle, &uri); + mp_media_info_get_title(item_data->handle, &title); + mp_media_info_get_artist(item_data->handle, &artist); + + mp_storage_type_e storage; + mp_media_info_get_storage_type(item_data->handle, + &storage); + + plst_item = + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); + } + } + } + gli2 = elm_genlist_item_next_get(gli2); + } + + if (ad->playlist_mgr->shuffle_state) { + ad->playlist_mgr->list = ad->playlist_mgr->shuffle_list; + } else { + ad->playlist_mgr->list = ad->playlist_mgr->normal_list; + } + + mp_playlist_mgr_set_current(ad->playlist_mgr, plst_item); + + PROFILE_IN("mp_play_destory"); + mp_play_fast_destory(ad); + PROFILE_OUT("mp_play_destory"); + + mp_play_new_file(ad, TRUE); +} + void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, Evas_Object * genlist, int playlist_id) @@ -1084,8 +1162,8 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, if (!ad->playlist_mgr) { mp_common_create_playlist_mgr(); } - MP_CHECK(ad->playlist_mgr); + /* before clear playlist_mgr, check if same playlist id */ if (ad->playlist_mgr->playlist_id == playlist_id) { playlist_update = false; @@ -1137,17 +1215,17 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, mp_storage_type_e storage; mp_media_info_get_storage_type(item_data->handle, - &storage); + &storage); plst_item = - mp_playlist_mgr_item_append(ad->playlist_mgr, uri, - uid, title, artist, - track_type); + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); if (playlist_id) { int member_id = 0; mp_media_info_get_playlist_member_id(item_data-> - handle, - &member_id); + handle, + &member_id); //mp_debug("playlist memeber id = %d", member_id); mp_playlist_mgr_item_set_playlist_memeber_id (plst_item, member_id); @@ -1175,9 +1253,9 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, PROFILE_IN("mp_playlist_mgr_set_current"); if (to_play == NULL) { mp_playlist_mgr_set_current(ad->playlist_mgr, - mp_playlist_mgr_get_nth(ad-> - playlist_mgr, - 0)); + mp_playlist_mgr_get_nth(ad-> + playlist_mgr, + 0)); } else { int shuffle = false; mp_setting_get_shuffle_state(&shuffle); @@ -1373,8 +1451,8 @@ void mp_common_create_playlist_mgr(void) DEBUG_TRACE("create playlist mgr"); ad->playlist_mgr = mp_playlist_mgr_create(); mp_playlist_mgr_set_item_change_callback(ad->playlist_mgr, - _mp_common_playlist_item_change_callback, - ad); + _mp_common_playlist_item_change_callback, + ad); int val = 0; mp_setting_get_shuffle_state(&val); mp_playlist_mgr_set_shuffle(ad->playlist_mgr, val); @@ -1452,18 +1530,17 @@ void mp_common_playlist_album_update(mp_media_info_h playlist_handle) media_info = mp_media_info_list_nth_item(svc_handle, count - 1); mp_media_info_get_thumbnail_path(media_info, &path); + char default_thumbnail[1024] = { 0 }; if (!path || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { - char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); free(shared_path); - path = g_strdup(default_thumbnail); } - mp_media_info_playlist_set_thumbnail_path(playlist_handle, path); + mp_media_info_playlist_set_thumbnail_path(playlist_handle, default_thumbnail); mp_media_info_list_destroy(svc_handle); } @@ -1765,6 +1842,7 @@ bool mp_common_parse_view_operation(app_control_h app_control) if (!strcmp(APP_CONTROL_OPERATION_VIEW, operation)) { struct appdata *ad = mp_util_get_appdata(); + MP_CHECK_FALSE(ad); char *value = NULL; ad->samsung_link = false; @@ -2578,9 +2656,6 @@ void mp_common_force_close_delete() void mp_common_view_check_changed_cb(void *data, Evas_Object * obj, void *event_info) { - char *uri = NULL; - mp_list_item_data_t *item = (mp_list_item_data_t *)data; - MP_CHECK(item); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -2590,6 +2665,9 @@ void mp_common_view_check_changed_cb(void *data, Evas_Object * obj, MP_CHECK(view); if (ad->selector_mode_bit) { + char *uri = NULL; + mp_list_item_data_t *item = (mp_list_item_data_t *)data; + MP_CHECK(item); mp_media_info_get_file_path(item->handle, &uri); if (item->checked) { ad->checkedList = g_list_append(ad->checkedList, g_strdup(uri)); diff --git a/src/common/mp-edit-callback.c b/src/common/mp-edit-callback.c index 8842831..94f15d1 100644 --- a/src/common/mp-edit-callback.c +++ b/src/common/mp-edit-callback.c @@ -864,6 +864,7 @@ _mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread * thread) _mp_edit_cb_check_playlist(); + ad->recentlyAddedGridView = true; if (g_edit_operation == MP_EDIT_ADD_TO_PLAYLIST && g_playlist_name) { /*keep previous playlist detail view, which to be popped after new view pushed */ MpView_t *previous_view = @@ -1041,11 +1042,11 @@ void mp_edit_cb_excute_delete(void *data) evas_object_show(popup); g_edit_thread = ecore_thread_feedback_run(_mp_edit_cb_delete_thread, - _mp_edit_cb_edit_thread_notify_cb, - _mp_edit_cb_edit_thread_end_cb, - _mp_edit_cb_edit_thread_cancel_cb, - (const void *) - g_selected_list, EINA_TRUE); + _mp_edit_cb_edit_thread_notify_cb, + _mp_edit_cb_edit_thread_end_cb, + _mp_edit_cb_edit_thread_cancel_cb, + (const void *) + g_selected_list, EINA_TRUE); if (!g_edit_thread) { mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_NO); diff --git a/src/core/mp-lyric-mgr.c b/src/core/mp-lyric-mgr.c index 60e16a7..c76a493 100644 --- a/src/core/mp-lyric-mgr.c +++ b/src/core/mp-lyric-mgr.c @@ -454,7 +454,7 @@ _mp_parse_lyric(mp_lyric_mgr_t * lyric_mgr, const char *musicPath) if (sync_len || unsync_len) { DEBUG_TRACE("sync_len=%d", sync_len); - if (sync_len > 0) { + if (sync_len > 0 && sync_len < 0x7FFFFFFF) { int ret = 0; int idx = 0; unsigned long time_info = 0; diff --git a/src/core/mp-playlist-mgr.c b/src/core/mp-playlist-mgr.c index 261ca72..c9c3136 100644 --- a/src/core/mp-playlist-mgr.c +++ b/src/core/mp-playlist-mgr.c @@ -531,7 +531,7 @@ mp_plst_item *mp_playlist_mgr_normal_list_get_nth(mp_plst_mgr * } mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr * playlist_mgr, - const char *uid) + const char *uid) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->list, NULL); @@ -552,9 +552,9 @@ mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr * playlist_mgr, } mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr * - playlist_mgr, - int - member_id) + playlist_mgr, + int + member_id) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->list, NULL); @@ -832,7 +832,9 @@ static Eina_Bool _mp_playlist_mgr_lazy_appender_timer_cb(void *data) /* uri */ if (fgets(line, MAX_NAM_LEN, appender->fp)) { line[MAX_NAM_LEN] = 0; - line[strlen(line) - 1] = 0; + if (strlen(line) > 0) { + line[strlen(line) - 1] = 0; + } } else { break; } @@ -916,7 +918,9 @@ mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr * /* uri */ if (fgets(line, MAX_NAM_LEN, fp)) { line[MAX_NAM_LEN] = 0; - line[strlen(line) - 1] = 0; + if (strlen(line) > 0) { + line[strlen(line) - 1] = 0; + } } else { break; } diff --git a/src/core/mp-setting-ctrl.c b/src/core/mp-setting-ctrl.c index 54924fe..d2c3040 100644 --- a/src/core/mp-setting-ctrl.c +++ b/src/core/mp-setting-ctrl.c @@ -491,7 +491,9 @@ int mp_setting_get_nowplaying_id(void) } if (fgets(line, MAX_NAM_LEN, fp)) { /* pid */ line[MAX_NAM_LEN] = 0; - line[strlen(line) - 1] = 0; + if (strlen(line) >= 1) { + line[strlen(line) - 1] = 0; + } pid = atoi(line); } fclose(fp); @@ -740,7 +742,9 @@ void mp_setting_get_now_playing_path_from_file(char **path) } if (fgets(line, MAX_NAM_LEN, fp)) { /* uri */ line[MAX_NAM_LEN] = 0; - line[strlen(line) - 1] = 0; + if (strlen(line) >= 1) { + line[strlen(line) - 1] = 0; + } *path = g_strdup(line); } fclose(fp); @@ -904,7 +908,9 @@ int mp_setting_read_playing_status(char *uri, char *status) value = strtok_r(NULL, "=", &sptr); DEBUG_TRACE("key is: %s and value is: %s", key, value); if (value != NULL) { - value[strlen(value) - 1] = '\0'; + if (strlen(value) >= 1) { + value[strlen(value) - 1] = '\0'; + } } else { DEBUG_TRACE("value is NULL"); continue; diff --git a/src/core/mp-view-mgr.c b/src/core/mp-view-mgr.c index 98e4f45..a4cd469 100644 --- a/src/core/mp-view-mgr.c +++ b/src/core/mp-view-mgr.c @@ -139,29 +139,28 @@ MpViewMgr_t *mp_view_mgr_create(Evas_Object * parent) MP_CHECK_NULL(parent); MpViewMgr_t *view_mgr = calloc(1, sizeof(MpViewMgr_t)); MP_CHECK_NULL(view_mgr); + g_view_mgr = view_mgr; view_mgr->navi = mp_widget_navigation_new(parent); struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); evas_object_event_callback_add(ad->win_main, EVAS_CALLBACK_RESIZE, - _mp_view_mgr_win_resize_cb, - view_mgr->navi); + _mp_view_mgr_win_resize_cb, + view_mgr->navi); eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_BACK, - eext_naviframe_back_cb, NULL); + eext_naviframe_back_cb, NULL); eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_MORE, - eext_naviframe_more_cb, NULL); + eext_naviframe_more_cb, NULL); evas_object_event_callback_add(view_mgr->navi, EVAS_CALLBACK_DEL, - _layout_del_cb, NULL); + _layout_del_cb, NULL); evas_object_smart_callback_add(view_mgr->navi, "transition,finished", - _mp_view_mg_transition_finish_cb, - view_mgr); - /* evas_object_smart_callback_add(view_mgr->navi, "title,clicked", _title_clicked_cb, view_mgr); */ + _mp_view_mg_transition_finish_cb, + view_mgr); - g_view_mgr = view_mgr; return view_mgr; } diff --git a/src/include/music.h b/src/include/music.h index 48f14c5..fa6dec2 100644 --- a/src/include/music.h +++ b/src/include/music.h @@ -232,7 +232,6 @@ typedef enum { } mp_device_type_e; struct appdata { - Evas *evas; Evas_Object *win_main; Evas_Object *bg; @@ -268,6 +267,7 @@ struct appdata { Evas_Object *conformant; Evas_Object *naviframe; bool hide_player_view; + bool recentlyAddedGridView; bool show_optional_menu; double music_pos; @@ -417,10 +417,6 @@ struct appdata { char *shortcut_descrition; - Ecore_Animator *minfo_ani; - GList *minfo_list; - Evas_Object *minfo_genlist; - bool direct_win_minimize; int album_image_w; diff --git a/src/mp-main.c b/src/mp-main.c index 9bf7874..a9bf92a 100644 --- a/src/mp-main.c +++ b/src/mp-main.c @@ -145,6 +145,7 @@ static bool _mp_main_init(struct appdata *ad) { ad->music_setting_change_flag = false; ad->paused_by_user = true; + ad->recentlyAddedGridView = false; bool key_exists = FALSE; int ret_p = preference_is_existing(PREF_MINICONTROLLER, &key_exists); @@ -682,6 +683,8 @@ _mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, } mp_playlist_mgr_clear(ad->playlist_mgr); + MP_CHECK_VAL(count > 0, -1); + MP_CHECK_VAL(count < 0x7FFFFFFF, -1); for (i = 0; i < count; i++, str = NULL) { token = strtok_r(str, MP_EXTRA_KEY_PLAY_FILE_DELIM, &save_ptr); @@ -1382,6 +1385,17 @@ static void mp_terminate(void *data) mp_lockscreenmini_destroy(ad); #endif + GList *list = ad->checkedList; + if (list) { + while(list){ + char *data = list->data; + IF_FREE(data); + list = g_list_next(list); + } + g_list_free(list); + list = NULL; + } + mp_player_mgr_vol_type_unset(); mp_player_mgr_safety_volume_set(0); diff --git a/src/view/mp-add-track-view.c b/src/view/mp-add-track-view.c index cdf48f0..c6671e2 100644 --- a/src/view/mp-add-track-view.c +++ b/src/view/mp-add-track-view.c @@ -177,10 +177,16 @@ static int _mp_add_track_view_content_load(void *view) /* Selector View is launched. Checked Items list is initially freed */ ad->selector_mode_bit = EINA_TRUE; - if (ad->checkedList) { - g_list_free(ad->checkedList); + GList *list = ad->checkedList; + if (list) { + while(list){ + char *data = list->data; + IF_FREE(data); + list = g_list_next(list); + } + g_list_free(list); + list = NULL; } - ad->checkedList = NULL; Evas_Object *obj; diff --git a/src/view/mp-album-detail-view.c b/src/view/mp-album-detail-view.c index 977685d..063844f 100644 --- a/src/view/mp-album-detail-view.c +++ b/src/view/mp-album-detail-view.c @@ -285,20 +285,20 @@ static void _mp_album_detail_view_content_load(void *thiz) MP_CHECK(view->album_detail_view_layout); view->content_to_show = - (MpList_t *) mp_album_detail_list_create(view->layout); + (MpList_t *) mp_album_detail_list_create(view->layout); MP_CHECK(view->content_to_show); mp_album_detail_list_set_data((MpAlbumDetailList_t *) view-> - content_to_show, - MP_ALBUM_DETAIL_LIST_TYPE, - MP_TRACK_BY_ALBUM, - MP_ALBUM_DETAIL_TYPE_STR, view->name, - MP_ALBUM_DETAIL_ARTIST, view->artist, - MP_ALBUM_DETAIL_THUMBNAIL, - view->thumbnail, -1); + content_to_show, + MP_ALBUM_DETAIL_LIST_TYPE, + MP_TRACK_BY_ALBUM, + MP_ALBUM_DETAIL_TYPE_STR, view->name, + MP_ALBUM_DETAIL_ARTIST, view->artist, + MP_ALBUM_DETAIL_THUMBNAIL, + view->thumbnail, -1); mp_list_update(view->content_to_show); elm_object_part_content_set(view->album_detail_view_layout, - "list_content", - view->content_to_show->layout); + "list_content", + view->content_to_show->layout); } diff --git a/src/view/mp-all-view.c b/src/view/mp-all-view.c index 6c0cfbf..8c369d1 100644 --- a/src/view/mp-all-view.c +++ b/src/view/mp-all-view.c @@ -300,6 +300,7 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); + ad->recentlyAddedGridView = true; /*the normal case */ if (!view->reorder_flag) { Elm_Object_Item *it = NULL; @@ -383,6 +384,7 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, break; } + ad->recentlyAddedGridView = false; view->content_to_show = list; content = mp_list_get_layout(list); if (content != NULL) { diff --git a/src/view/mp-edit-view.c b/src/view/mp-edit-view.c index ddb7c70..e403279 100644 --- a/src/view/mp-edit-view.c +++ b/src/view/mp-edit-view.c @@ -444,13 +444,13 @@ static int _mp_edit_view_content_load(void *thiz) #endif if (view->ref_list->reorderable) { mp_list_set_reorder((MpList_t *) view->content_to_show, - TRUE); + TRUE); } mp_track_list_copy_data((MpTrackList_t *) ref_list, - (MpTrackList_t *) view-> - content_to_show); + (MpTrackList_t *) view-> + content_to_show); edje_object_signal_emit(_EDJ(view->layout), - "SHOW_SELECT_ALL_PADDING", "*"); + "SHOW_SELECT_ALL_PADDING", "*"); break; } case MP_LIST_TYPE_GROUP: diff --git a/src/view/mp-player-view.c b/src/view/mp-player-view.c index 1afe200..f76298b 100644 --- a/src/view/mp-player-view.c +++ b/src/view/mp-player-view.c @@ -757,9 +757,9 @@ _mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, MpView_t *view = NULL; view = (MpView_t *) mp_playlist_detail_view_create(GET_NAVIFRAME, - MP_TRACK_BY_PLAYLIST, - playlist_name, - playlist_id); + MP_TRACK_BY_PLAYLIST, + playlist_name, + playlist_id); mp_view_mgr_push_view(GET_VIEW_MGR, view, NULL); mp_view_update_options(view); mp_view_set_title(view, playlist_name); diff --git a/src/view/mp-select-track-view.c b/src/view/mp-select-track-view.c index a9a19e8..80a859c 100644 --- a/src/view/mp-select-track-view.c +++ b/src/view/mp-select-track-view.c @@ -123,16 +123,16 @@ static void _mp_select_track_view_content_load(void *thiz) MP_CHECK(view->layout); view->content_to_show = - (MpList_t *) mp_track_list_create(view->layout); + (MpList_t *) mp_track_list_create(view->layout); MP_CHECK(view->content_to_show); /*Todo: move the followed outside */ /* mp_track_list_set_data(view->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, view->name, -1); view->content_to_show->update(view->content_to_show); */ MP_CHECK(view->content_to_show->layout); elm_object_part_content_set(view->layout, "list_content", - view->content_to_show->layout); + view->content_to_show->layout); edje_object_signal_emit(_EDJ(view->layout), "SHOW_SELECT_ALL_PADDING", - "*"); + "*"); } static void _mp_select_track_view_on_event(void *thiz, MpViewEvent_e event) diff --git a/src/widget/include/mp-album-list.h b/src/widget/include/mp-album-list.h index d3c4365..5dc1c2f 100644 --- a/src/widget/include/mp-album-list.h +++ b/src/widget/include/mp-album-list.h @@ -34,7 +34,6 @@ typedef struct __MpAlbumList { mp_media_list_h album_list; int album_list_count; - } MpAlbumList_t; MpAlbumList_t *mp_album_list_create(Evas_Object * parent); diff --git a/src/widget/include/mp-artist-list.h b/src/widget/include/mp-artist-list.h index 42bd3e8..99857d2 100644 --- a/src/widget/include/mp-artist-list.h +++ b/src/widget/include/mp-artist-list.h @@ -35,6 +35,7 @@ typedef struct __MpArtistList { Elm_Genlist_Item_Class *itc_group_index; Elm_Object_Item *group_it; void (*set_edit_default) (void *thiz, bool edit); + mp_media_list_h artist_list; int artist_list_count; } MpArtistList_t; diff --git a/src/widget/include/mp-list.h b/src/widget/include/mp-list.h index 922be81..9b14477 100644 --- a/src/widget/include/mp-list.h +++ b/src/widget/include/mp-list.h @@ -148,6 +148,9 @@ typedef enum { MpTrackListIndex_t index_type; \ MpListFunction_e function_type; \ GList *checked_path_list; \ + Elm_Genlist_Item_Class *itc_group_index_recently_added; \ + Elm_Genlist_Item_Class *itc_genlist_recently_added; \ + Evas_Object *recently_added_genlist; \ typedef struct __MpList { INHERIT_MP_LIST} MpList_t; diff --git a/src/widget/include/mp-track-list.h b/src/widget/include/mp-track-list.h index 91117c0..e77b164 100644 --- a/src/widget/include/mp-track-list.h +++ b/src/widget/include/mp-track-list.h @@ -49,7 +49,6 @@ typedef struct __MpTrackList { int track_count; bool get_by_view; - } MpTrackList_t; MpTrackList_t *mp_track_list_create(Evas_Object * parent); diff --git a/src/widget/mp-album-detail-list.c b/src/widget/mp-album-detail-list.c index 5ef4410..e99fbca 100644 --- a/src/widget/mp-album-detail-list.c +++ b/src/widget/mp-album-detail-list.c @@ -193,7 +193,7 @@ _mp_album_detail_list_item_del_cb(void *data, Evas_Object * obj) static void _mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, - void *event_info) + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -551,7 +551,6 @@ void mp_album_detail_list_show_shuffle(void *thiz, bool show) list->itc_shuffle = elm_genlist_item_class_new(); MP_CHECK(list->itc_shuffle); - //list->itc_shuffle->item_style = "music/1line"; list->itc_shuffle->item_style = "default"; list->itc_shuffle->func.text_get = _mp_album_detail_list_shuffle_text_get; @@ -626,19 +625,19 @@ static void _mp_album_detail_list_load_list(void *thiz, int count) /*get data from DB */ PROFILE_IN("mp_media_info_list_create"); mp_media_info_list_create(&svc_handle, list->track_type, - list->type_str, list->type_str2, - list->filter_str, list->playlist_id, 0, - count); + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); PROFILE_OUT("mp_media_info_list_create"); mp_album_detail_list_show_shuffle(list, true); list->total_duration = - _mp_album_detail_list_get_total_duration(list, svc_handle, - list->track_count); + _mp_album_detail_list_get_total_duration(list, svc_handle, + list->track_count); list->various_name = - _mp_ablum_detail_list_check_artist_name(svc_handle, count); + _mp_ablum_detail_list_check_artist_name(svc_handle, count); PROFILE_IN("_mp_album_detail_list_append_item"); _mp_album_detail_list_append_item(list, svc_handle, count); diff --git a/src/widget/mp-album-list.c b/src/widget/mp-album-list.c index c43bf11..27c6948 100644 --- a/src/widget/mp-album-list.c +++ b/src/widget/mp-album-list.c @@ -26,6 +26,7 @@ #include "mp-util.h" #include "mp-widget.h" #include "mp-common.h" +#include "mp-play.h" #define ALBUM_GRID_W 233 #define ALBUM_GRID_H 319 @@ -33,6 +34,8 @@ #define ALBUM_GRID_LAND_H 320 #define ALBUM_ICON_SIZE 70 +static mp_list_item_data_t* g_item_data = NULL; + static void _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info); @@ -93,7 +96,6 @@ static char *_mp_album_list_label_get(void *data, Evas_Object * obj, return g_strdup(elm_entry_utf8_to_markup(name)); } - DEBUG_TRACE("Unusing part: %s", part); return NULL; } @@ -118,14 +120,7 @@ Evas_Object *_mp_album_list_icon_get(void *data, Evas_Object * obj, mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); int w, h; if (item->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { - //if (landscape) - //{ w = ALBUM_ICON_SIZE * elm_config_scale_get(); - //} - //else - //{ - //w = ALBUM_ICON_SIZE * elm_config_scale_get(); - //} } else { w = ALBUM_ICON_SIZE; } @@ -144,7 +139,6 @@ Evas_Object *_mp_album_list_icon_get(void *data, Evas_Object * obj, MP_CHECK_NULL(list); Evas_Object *check = NULL; - DEBUG_TRACE("list->edit_mode = %d", list->edit_mode); if (list->edit_mode) { // if edit mode @@ -237,9 +231,9 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) mp_view_set_title((MpView_t *) view_select_track, STR_MP_TILTE_SELECT_ITEM); } mp_track_list_set_data((MpTrackList_t *) view_select_track-> - content_to_show, MP_TRACK_LIST_TYPE, - MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, - name, -1); + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, + name, -1); mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, true); mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, @@ -261,7 +255,6 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) return; } - /* create the view of album detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); @@ -272,6 +265,7 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) NULL); mp_view_update_options((MpView_t *) view_album_detail); + mp_view_set_title((MpView_t *) view_album_detail, name); } static void _mp_album_list_append_group_index_item(void *thiz) @@ -347,9 +341,9 @@ static void _mp_album_list_load_list(void *thiz, int count) } ret = - mp_media_info_group_list_create(&list->album_list, - MP_GROUP_BY_ALBUM, NULL, NULL, 0, - count); + mp_media_info_group_list_create(&list->album_list, + MP_GROUP_BY_ALBUM, NULL, NULL, 0, + count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); @@ -368,8 +362,8 @@ static void _mp_album_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { DEBUG_TRACE - ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", - ret, index); + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -380,28 +374,28 @@ static void _mp_album_list_load_list(void *thiz, int count) item_data->handle = item; item_data->index = index; item_data->checked = - mp_list_is_in_checked_path_list(list->checked_path_list, - title); + mp_list_is_in_checked_path_list(list->checked_path_list, + title); if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { list_item = - elm_gengrid_item_append(list->genlist, list->gengrid_itc, - item_data, _mp_album_select_cb, - (void *) list); + elm_gengrid_item_append(list->genlist, list->gengrid_itc, + item_data, _mp_album_select_cb, + (void *) list); } else { Elm_Object_Item *parent_group = NULL; list_item = - elm_genlist_item_append(list->genlist, list->itc, - item_data, parent_group, - ELM_GENLIST_ITEM_NONE, - _mp_album_select_cb, - (void *) list); + elm_genlist_item_append(list->genlist, list->itc, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_album_select_cb, + (void *) list); } item_data->it = list_item; elm_object_item_data_set(item_data->it, item_data); } - END: + END: endfunc; } @@ -527,12 +521,501 @@ static void _mp_album_list_gengrid_create(MpAlbumList_t * list) list->gengrid_itc->func.del = _mp_album_list_item_del_cb; } _mp_album_list_set_grid_style(list); - //evas_object_smart_callback_add(list->genlist, "longpressed", _mp_album_list_item_longpressed_cb, list); elm_gengrid_align_set(list->genlist, 0.5, 0.0); endfunc; } +static void mp_album_list_initialize_recently_added(MpAlbumList_t *list) +{ + MP_CHECK(list); + + mp_evas_object_del(list->recently_added_genlist); + list->recently_added_genlist = mp_widget_genlist_create(list->box); + MP_CHECK(list->recently_added_genlist); + elm_scroller_policy_set(list->recently_added_genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->recently_added_genlist, EVAS_HINT_EXPAND, + 0.5); + evas_object_size_hint_align_set(list->recently_added_genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_genlist_mode_set(list->recently_added_genlist, ELM_LIST_COMPRESS); + evas_object_show(list->recently_added_genlist); + /*packet genlist to box */ + elm_box_pack_end(list->box, list->recently_added_genlist); + + evas_object_data_set(list->recently_added_genlist, "list_data", list); +} + +void _mp_album_list_recently_added_del_cb(void *data, Evas_Object * obj) +{ + mp_media_list_h *svc_handle = (mp_media_list_h *) data; + MP_CHECK(svc_handle); + IF_FREE(svc_handle); + IF_FREE(g_item_data); +} + +char *_mp_album_list_group_index_recently_added_text_get(void *data, + Evas_Object *obj, + const char *part) +{ + char *text = NULL; + if (!g_strcmp0(part, "elm.text")) { + int len = strlen(GET_STR(STR_RECENTLY_ADDED)) + strlen(GET_STR(STR_MP_ARTISTS)) + 2; + text = (char *)malloc(len); + MP_CHECK_NULL(text); + snprintf(text, len, "%s %s", GET_STR(STR_RECENTLY_ADDED), GET_STR(STR_MP_ALBUMS)); + } + + return text; +} + +static void _mp_album_list_recently_added_play_icon_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + int count = 0, res = 0; + mp_list_item_data_t *item_data = (mp_list_item_data_t *)data; + MP_CHECK(item_data); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + mp_media_info_h track = item_data->handle; + MP_CHECK(track); + + MpAlbumDetailList_t *list = calloc(1, sizeof(MpAlbumDetailList_t)); + MP_CHECK(list); + + mp_media_list_h svc_handle; + mp_plst_item *plst_item = NULL; + char *title = NULL; + char *artist = NULL; + char *thumbnail = NULL; + mp_media_info_group_get_main_info(track, &title); + mp_media_info_group_get_sub_info(track, &artist); + mp_media_info_group_get_thumbnail_path(track, &thumbnail); + DEBUG_TRACE("thumbnail = %s", thumbnail); + + list->list_type = MP_LIST_TYPE_ALBUM_DETAIL; + list->track_type = MP_TRACK_BY_ALBUM; + list->type_str = title; + list->artist = artist; + list->thumbnail = thumbnail; + + PROFILE_IN("mp_media_info_list_count"); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); + PROFILE_OUT("mp_media_info_list_count"); + + PROFILE_IN("mp_media_info_list_create"); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); + PROFILE_OUT("mp_media_info_list_create"); + IF_FREE(list); + + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + + char *uri = NULL; + char *uid = NULL; + item = mp_media_info_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + continue; + } + mp_track_type track_type = MP_TRACK_URI; + mp_media_info_get_media_id(item, &uid); + mp_media_info_get_file_path(item, &uri); + mp_media_info_get_title(item, &title); + mp_media_info_get_artist(item, &artist); + + if (!ad->playlist_mgr) { + mp_common_create_playlist_mgr(); + } + MP_CHECK(ad->playlist_mgr); + + PROFILE_IN("mp_playlist_mgr_clear"); + mp_playlist_mgr_clear(ad->playlist_mgr); + PROFILE_OUT("mp_playlist_mgr_clear"); + + if (!index) { + plst_item = + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); + } else { + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); + } + } + + ad->hide_player_view = true; + ad->paused_by_user = false; + + if (ad->playlist_mgr->shuffle_state) { + ad->playlist_mgr->list = ad->playlist_mgr->shuffle_list; + } else { + ad->playlist_mgr->list = ad->playlist_mgr->normal_list; + } + + mp_playlist_mgr_set_current(ad->playlist_mgr, plst_item); + + PROFILE_IN("mp_play_destory"); + mp_play_fast_destory(ad); + PROFILE_OUT("mp_play_destory"); + + mp_play_new_file(ad, TRUE); +} + +static void _mp_album_list_recently_added_thumbpath_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + mp_list_item_data_t *item = (mp_list_item_data_t *)data; + MP_CHECK(item); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + Evas_Object* genlist = evas_object_data_get(obj, "genlist_obj"); + MP_CHECK(genlist); + + MpAlbumList_t *list = evas_object_data_get(genlist, "list_data"); + MP_CHECK(list); + + mp_media_info_h track = item->handle; + MP_CHECK(track); + + int ret = 0; + int index = 0; + char *name = NULL; + char *artist = NULL; + char *title = NULL; + char *thumbnail = NULL; + + index = item->index; + + DEBUG_TRACE("index is %d", index); + if (index >= 0) { + DEBUG_TRACE(""); + ret = mp_media_info_group_get_main_info(track, &name); + DEBUG_TRACE(""); + ret = mp_media_info_group_get_sub_info(track, &artist); + DEBUG_TRACE(""); + mp_media_info_group_get_thumbnail_path(track, + &thumbnail); + DEBUG_TRACE("thumbnail=%s", thumbnail); + mp_retm_if(ret != 0, "Fail to get value"); + mp_retm_if(name == NULL, "Fail to get value"); + + if (!name || !strlen(name)) { + name = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); + } + if (!artist || !strlen(artist)) { + artist = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); + } + title = name; + } + + + if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { + MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); + MP_CHECK(view_manager); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); + MP_CHECK(view_select_track); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + int count = g_list_length(ad->checkedList); + if (count > 0) { + char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); + mp_view_set_title((MpView_t *) view_select_track, text); + IF_FREE(text); + } else { + mp_view_set_title((MpView_t *) view_select_track, STR_MP_TILTE_SELECT_ITEM); + } + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, + name, -1); + mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, + true); + mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, + MP_DONE_SELECT_ADD_TRACK_TYPE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); + mp_list_update(view_select_track->content_to_show); + mp_view_update_options((MpView_t *) view_select_track); + mp_list_set_edit(view_select_track->content_to_show, TRUE); + return; + } + + if (list->edit_mode) { + mp_list_edit_mode_sel((MpList_t *) list, item); + MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); + MpView_t *view = mp_view_mgr_get_top_view(view_mgr); + mp_view_update_options_edit(view); + return; + } + + + /* create the view of album detail */ + MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); + MP_CHECK(view_manager); + MpAlbumDetailView_t *view_album_detail = + mp_album_detail_view_create(view_manager->navi, name, artist, + thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_album_detail, + NULL); + + mp_view_update_options((MpView_t *) view_album_detail); + mp_view_set_title((MpView_t *) view_album_detail, name); +} + +char *_mp_album_list_recently_added_text_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h svc_handle = (mp_media_list_h) data; + MP_CHECK_NULL(svc_handle); + + MpAlbumList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + + int count = (list->album_list_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->album_list_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *title = NULL; + char *artist = NULL; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_group_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", "elm.text.main.", (index+1)); + if (!g_strcmp0(part, part_name)) { + mp_media_info_group_get_main_info(item, &title); + if (!title || !strlen(title)) { + title = GET_SYS_STR("IDS_COM_BODY_UNKNOWN"); + } + return g_strdup(title); + } + part_name[0] = '\0'; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", "elm.text.sub.", (index+1)); + if (!g_strcmp0(part, part_name)) { + mp_media_info_group_get_sub_info(item, &artist); + if (!artist || !strlen(artist)) { + artist = GET_SYS_STR("IDS_COM_BODY_UNKNOWN"); + } + return g_strdup(artist); + } + } + return NULL; +} + +Evas_Object *_mp_album_list_recently_added_content_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h svc_handle = (mp_media_list_h) data; + MP_CHECK_NULL(svc_handle); + + MpAlbumList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + int count = (list->album_list_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->album_list_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *thumb_path = NULL; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_group_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + mp_media_info_group_get_thumbnail_path(item, &thumb_path); + if (!thumb_path) { + char default_thumbnail[1024] = { 0 }; + char *shared_path = app_get_shared_resource_path(); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); + free(shared_path); + thumb_path = g_strdup(default_thumbnail); + } + + mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + MP_CHECK_NULL(item_data); + item_data->handle = item; + item_data->index = index; + item_data->group_type = MP_GROUP_BY_ALBUM; + if (g_item_data) { + free(g_item_data); + } + g_item_data = item_data; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", + "elm.swallow.", (index+1)); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, thumb_path,NULL); + elm_image_fill_outside_set(image, true); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_album_list_recently_added_thumbpath_clicked_cb, item_data); + return content; + } + part_name[0] = '\0'; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d%s", "elm.swallow.", (index+1), ".play"); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + char play_thumbnail[1024] = { 0 }; + char *shared_path = app_get_shared_resource_path(); + snprintf(play_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", RECENTLY_ADDED_PLAY_ICON); + free(shared_path); + thumb_path = g_strdup(play_thumbnail); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, thumb_path, NULL); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_album_list_recently_added_play_icon_clicked_cb, item_data); + return content; + } + } + return NULL; +} + +static Elm_Object_Item *_mp_album_list_append_group_index(void *thiz) +{ + startfunc; + MpAlbumList_t *list = thiz; + MP_CHECK_NULL(list); + MP_CHECK_NULL(list->recently_added_genlist); + + Elm_Object_Item *group_index = NULL; + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK_NULL(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_group_index_recently_added, item_data, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + group_index = item_data->it; + elm_genlist_item_select_mode_set(group_index, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + return group_index; +} + +static void _mp_album_list_append_recently_added(void *thiz, mp_media_list_h svc_handle) +{ + startfunc; + MpAlbumList_t *list = thiz; + MP_CHECK(list); + MP_CHECK(list->recently_added_genlist); + mp_list_item_data_t *item_data; + + item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_genlist_recently_added, svc_handle, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); +} + +static void mp_album_list_show_recently_added_tracks(void *thiz) +{ + startfunc; + MP_CHECK(thiz); + MpAlbumList_t *list = thiz; + int count = 0, res = 0; + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + if (!list->itc_group_index_recently_added) { + list->itc_group_index_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_group_index_recently_added); + list->itc_group_index_recently_added->item_style = "group_index"; + list->itc_group_index_recently_added->func.text_get = + _mp_album_list_group_index_recently_added_text_get; + list->itc_group_index_recently_added->func.content_get = + NULL; + list->itc_group_index_recently_added->func.del = + _mp_album_list_recently_added_del_cb; + } + + _mp_album_list_append_group_index(list); + + if (!list->itc_genlist_recently_added) { + list->itc_genlist_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_genlist_recently_added); + list->itc_genlist_recently_added->item_style = "recently_added"; + list->itc_genlist_recently_added->func.text_get = + _mp_album_list_recently_added_text_get; + list->itc_genlist_recently_added->func.content_get = + _mp_album_list_recently_added_content_get; + list->itc_genlist_recently_added->func.del = + _mp_album_list_recently_added_del_cb; + } + + mp_media_list_h svc_handle = NULL; + + list->track_type = MP_TRACK_BY_ADDED_TIME; + list->playlist_id = 0; + + PROFILE_IN("mp_media_info_list_count"); + res = + mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, NULL, + &count); + PROFILE_OUT("mp_media_info_list_count"); + MP_CHECK(res == 0); + list->album_list_count = count; + + PROFILE_IN("mp_media_info_list_create"); + res = + mp_media_info_group_list_create(&svc_handle, + MP_GROUP_BY_ALBUM, NULL, NULL, 0, + count); + PROFILE_OUT("mp_media_info_list_create"); + MP_CHECK(svc_handle); + + PROFILE_IN("_mp_album_list_append_recently_added"); + _mp_album_list_append_recently_added(list, svc_handle); + PROFILE_OUT("_mp_album_list_append_recently_added"); +} + static void _mp_album_list_update(void *thiz) { startfunc; @@ -556,6 +1039,12 @@ static void _mp_album_list_update(void *thiz) mp_evas_object_del(list->no_content); if (count) { + // Place Recently Added Grid View only when there are some items in genlist + if (ad->recentlyAddedGridView) { + mp_album_list_initialize_recently_added(list); + } + + /*create new genlist */ if (list->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_album_list_gengrid_create(list); } else { @@ -565,6 +1054,10 @@ static void _mp_album_list_update(void *thiz) evas_object_data_set(list->genlist, "list_handle", list); if (!list->edit_mode) { + if (ad->recentlyAddedGridView) { + mp_album_list_show_recently_added_tracks(list); + ad->recentlyAddedGridView = false; + } mp_list_bottom_counter_item_append((MpList_t *) list); } diff --git a/src/widget/mp-artist-detail-list.c b/src/widget/mp-artist-detail-list.c index 91df586..d566b91 100644 --- a/src/widget/mp-artist-detail-list.c +++ b/src/widget/mp-artist-detail-list.c @@ -506,11 +506,11 @@ static int _mp_artist_detail_list_append_album_tracks(void *thiz, } item_data->it = - elm_genlist_item_append(list->genlist, list->itc_track, - item_data, parent_group, - ELM_GENLIST_ITEM_NONE, - _mp_artist_detail_list_select_cb, - list); + elm_genlist_item_append(list->genlist, list->itc_track, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_artist_detail_list_select_cb, + list); } list->track_lists = g_list_append(list->track_lists, svc_handle); diff --git a/src/widget/mp-artist-list.c b/src/widget/mp-artist-list.c index 0f0e05a..320b5b8 100644 --- a/src/widget/mp-artist-list.c +++ b/src/widget/mp-artist-list.c @@ -16,24 +16,26 @@ #include "mp-artist-list.h" #include "mp-artist-detail-view.h" +#include "mp-artist-detail-list.h" #include "mp-create-playlist-view.h" #include "mp-select-track-view.h" #include "mp-popup.h" -/*#include "shortcut.h"*/ #include "mp-menu.h" #include "mp-util.h" #include "mp-widget.h" #include "mp-common.h" - +#include "mp-play.h" #define ARTIST_GRID_W 175 #define ARTIST_GRID_H 222 #define ARTIST_GRID_LAND_W 179 #define ARTIST_GRID_LAND_H 240 +static mp_list_item_data_t* g_item_data = NULL; + static char *_mp_artist_list_group_index_text_get(void *data, - Evas_Object * obj, - const char *part) + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -44,9 +46,9 @@ static char *_mp_artist_list_group_index_text_get(void *data, MP_CHECK_NULL(list); unsigned int count = - mp_list_get_editable_count((MpList_t *) list, - mp_list_get_edit_type((MpList_t *) - list)); + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_ARTIST)); @@ -60,7 +62,7 @@ static char *_mp_artist_list_group_index_text_get(void *data, static void _mp_artist_list_add_to_playlist_cb(void *data, Evas_Object * obj, - void *event_info) + void *event_info) { eventfunc; mp_edit_create_add_to_playlist_popup(data); @@ -68,7 +70,7 @@ _mp_artist_list_add_to_playlist_cb(void *data, Evas_Object * obj, } static char *_mp_artist_list_label_get(void *data, Evas_Object * obj, - const char *part) + const char *part) { char *name = NULL; int ret = 0; @@ -91,8 +93,8 @@ static char *_mp_artist_list_label_get(void *data, Evas_Object * obj, int song_count = 0; mp_media_info_group_get_album_thumnail_paths(item->handle, - &album_thumbs, - &album_count); + &album_thumbs, + &album_count); mp_media_info_group_get_track_count(item->handle, &song_count); char *sub_text = NULL; @@ -100,12 +102,12 @@ static char *_mp_artist_list_label_get(void *data, Evas_Object * obj, sub_text = g_strdup(GET_STR(STR_MP_1_ALBUM_1_SONG)); } else if (album_count == 1 && song_count > 1) { sub_text = - g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), - song_count); + g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), + song_count); } else { sub_text = - g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), - album_count, song_count); + g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), + album_count, song_count); } return sub_text; } @@ -113,23 +115,9 @@ static char *_mp_artist_list_label_get(void *data, Evas_Object * obj, return NULL; } -/* -static void -_mp_artist_list_more_btn_cb(void *data, Evas_Object *obj, void *event_info) -{ - eventfunc; - mp_list_item_data_t *item = data; - MP_CHECK(item); - MP_CHECK(item->it); - item->artist_album_page++; - mp_debug("next artist album page = %d", item->artist_album_page); - elm_genlist_item_fields_update(item->it, "elm.icon", ELM_GENLIST_ITEM_FIELD_CONTENT); -} -*/ - static Evas_Object *_mp_artist_list_album_icon_get(Evas_Object * obj, - mp_list_item_data_t * - item) + mp_list_item_data_t * + item) { MP_CHECK_NULL(item); MP_CHECK_NULL(item->handle); @@ -147,8 +135,8 @@ static Evas_Object *_mp_artist_list_album_icon_get(Evas_Object * obj, char *path = NULL; mp_media_info_group_get_album_thumnail_paths(item->handle, - &album_thumbs, - &album_count); + &album_thumbs, + &album_count); mp_media_info_group_get_track_count(item->handle, &song_count); for (i = 0; i < album_count; i++) { @@ -162,14 +150,14 @@ static Evas_Object *_mp_artist_list_album_icon_get(Evas_Object * obj, path = album_thumbs[i]; } Evas_Object *icon = - mp_util_create_lazy_update_thumb_icon(obj, path, image_size, - image_size); + mp_util_create_lazy_update_thumb_icon(obj, path, image_size, + image_size); return icon; } Evas_Object *_mp_artist_list_icon_get(void *data, Evas_Object * obj, - const char *part) + const char *part) { Evas_Object *icon = NULL; @@ -183,11 +171,11 @@ Evas_Object *_mp_artist_list_icon_get(void *data, Evas_Object * obj, if (item->display_mode == MP_LIST_DISPLAY_MODE_NORMAL) { if (!strcmp(part, "elm.icon.1") - || !strcmp(part, "elm.swallow.icon")) { + || !strcmp(part, "elm.swallow.icon")) { content = elm_layout_add(obj); Evas_Object *icon = _mp_artist_list_album_icon_get(obj, item); elm_layout_theme_set(content, "layout", "list/B/music.type.1", - "default"); + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -204,8 +192,8 @@ Evas_Object *_mp_artist_list_icon_get(void *data, Evas_Object * obj, mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, STR_MP_ADD_TO); */ mp_util_domain_translatable_text_set(button, STR_MP_ADD_TO); evas_object_smart_callback_add(button, "clicked", - _mp_artist_list_add_to_playlist_cb, - list); + _mp_artist_list_add_to_playlist_cb, + list); return button; } @@ -216,8 +204,8 @@ Evas_Object *_mp_artist_list_icon_get(void *data, Evas_Object * obj, elm_object_style_set(check, "default"); evas_object_propagate_events_set(check, EINA_FALSE); evas_object_smart_callback_add(check, "changed", - mp_common_view_check_changed_cb, - NULL); + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(check, &item->checked); return check; @@ -267,7 +255,7 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) /*item_handle = mp_media_info_group_list_nth_item(gli_data->handle, index); */ ret = mp_media_info_group_get_main_info(gli_data->handle, &name); mp_media_info_group_get_thumbnail_path(gli_data->handle, - &thumbnail); + &thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); } @@ -276,10 +264,10 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); MpSelectTrackView_t *view_select_track = - mp_select_track_view_create(view_manager->navi); + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, - NULL); + NULL); int count = g_list_length(ad->checkedList); if (count > 0) { @@ -290,15 +278,15 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) mp_view_set_title((MpView_t *) view_select_track, STR_MP_TILTE_SELECT_ITEM); } mp_track_list_set_data((MpTrackList_t *) view_select_track-> - content_to_show, MP_TRACK_LIST_TYPE, - MP_TRACK_BY_ARTIST, MP_TRACK_LIST_TYPE_STR, - name, -1); + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ARTIST, MP_TRACK_LIST_TYPE_STR, + name, -1); mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, - true); + true); mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, - MP_DONE_SELECT_ADD_TRACK_TYPE); + MP_DONE_SELECT_ADD_TRACK_TYPE); mp_list_view_set_select_all((MpListView_t *) view_select_track, - TRUE); + TRUE); mp_list_update(view_select_track->content_to_show); mp_view_update_options((MpView_t *) view_select_track); mp_list_set_edit(view_select_track->content_to_show, TRUE); @@ -315,17 +303,16 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) return; } - /* create the view of album detail */ + /* create the view of artist detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); MpArtistDetailView_t *view_artist_detail = - mp_artist_detail_view_create(view_manager->navi, name, thumbnail); + mp_artist_detail_view_create(view_manager->navi, name, thumbnail); MP_CHECK(view_artist_detail); mp_view_mgr_push_view(view_manager, (MpView_t *) view_artist_detail, - NULL); + NULL); mp_view_update_options((MpView_t *) view_artist_detail); mp_view_set_title((MpView_t *) view_artist_detail, name); - } static void _mp_artist_list_append_group_index_item(void *thiz) @@ -339,19 +326,19 @@ static void _mp_artist_list_append_group_index_item(void *thiz) MP_CHECK(list->itc_group_index); list->itc_group_index->item_style = "music/groupindex.sub"; list->itc_group_index->func.text_get = - _mp_artist_list_group_index_text_get; + _mp_artist_list_group_index_text_get; list->itc_group_index->func.del = _mp_artist_list_item_del_cb; } mp_list_item_data_t *item_data = - mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); MP_CHECK(item_data); item_data->it = list->group_it = - elm_genlist_item_append(list->genlist, list->itc_group_index, - item_data, NULL, ELM_GENLIST_ITEM_GROUP, - NULL, NULL); + elm_genlist_item_append(list->genlist, list->itc_group_index, + item_data, NULL, ELM_GENLIST_ITEM_GROUP, + NULL, NULL); elm_genlist_item_select_mode_set(list->group_it, - ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } void mp_artist_list_show_group_index(void *thiz, bool show) @@ -362,7 +349,7 @@ void mp_artist_list_show_group_index(void *thiz, bool show) MP_CHECK(list->genlist); DEBUG_TRACE("show group index: %d list->group_it: %0x", show, - list->group_it); + list->group_it); if (show) { _mp_artist_list_append_group_index_item(list); } else if (list->group_it) { @@ -388,9 +375,9 @@ static void _mp_artist_list_load_list(void *thiz, int count) } ret = - mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, - list->type_str, list->filter_str, - 0, count); + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, + list->type_str, list->filter_str, + 0, count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); @@ -413,8 +400,8 @@ static void _mp_artist_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { DEBUG_TRACE - ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", - ret, index); + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -427,27 +414,27 @@ static void _mp_artist_list_load_list(void *thiz, int count) item_data->index = index; item_data->display_mode = list->display_mode; item_data->checked = - mp_list_is_in_checked_path_list(list->checked_path_list, - title); + mp_list_is_in_checked_path_list(list->checked_path_list, + title); Elm_Object_Item *parent_group = NULL; if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { list_item = - elm_gengrid_item_append(list->genlist, list->gengrid_itc, - item_data, _mp_artist_select_cb, - (void *) list); + elm_gengrid_item_append(list->genlist, list->gengrid_itc, + item_data, _mp_artist_select_cb, + (void *) list); } else { list_item = - elm_genlist_item_append(list->genlist, list->itc, - item_data, parent_group, - ELM_GENLIST_ITEM_NONE, - _mp_artist_select_cb, list); + elm_genlist_item_append(list->genlist, list->itc, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_artist_select_cb, list); } item_data->it = list_item; } - END: + END: endfunc; } @@ -611,7 +598,6 @@ static void _mp_artist_list_set_grid_style(MpArtistList_t * list) elm_gengrid_item_size_set(list->genlist, w, h); } - static void _mp_artist_list_gengrid_create(MpArtistList_t * list) { startfunc; @@ -621,9 +607,9 @@ static void _mp_artist_list_gengrid_create(MpArtistList_t * list) list->genlist = elm_gengrid_add(list->box); MP_CHECK(list->genlist); evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, - EVAS_HINT_FILL); + EVAS_HINT_FILL); evas_object_show(list->genlist); MP_LIST_OBJ_SET_AS_GENGRID(list->genlist); /*packet genlist to box */ @@ -641,16 +627,475 @@ static void _mp_artist_list_gengrid_create(MpArtistList_t * list) elm_gengrid_align_set(list->genlist, 0.5, 0.0); evas_object_smart_callback_add(list->genlist, "highlighted", - _mp_artist_list_item_highlighted_cb, - list); + _mp_artist_list_item_highlighted_cb, + list); evas_object_smart_callback_add(list->genlist, "unhighlighted", - _mp_artist_list_item_unhighlighted_cb, - list); - /*evas_object_smart_callback_add(list->genlist, "longpressed", _mp_artist_list_item_longpressed_cb, list); */ + _mp_artist_list_item_unhighlighted_cb, + list); endfunc; } +static void mp_artist_list_initialize_recently_added(MpArtistList_t *list) +{ + MP_CHECK(list); + + mp_evas_object_del(list->recently_added_genlist); + list->recently_added_genlist = mp_widget_genlist_create(list->box); + MP_CHECK(list->recently_added_genlist); + elm_scroller_policy_set(list->recently_added_genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->recently_added_genlist, EVAS_HINT_EXPAND, + 0.5); + evas_object_size_hint_align_set(list->recently_added_genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_genlist_mode_set(list->recently_added_genlist, ELM_LIST_COMPRESS); + evas_object_show(list->recently_added_genlist); + /*packet genlist to box */ + elm_box_pack_end(list->box, list->recently_added_genlist); + + evas_object_data_set(list->recently_added_genlist, "list_data", list); +} + +static void _mp_artist_list_recently_added_del_cb(void *data, Evas_Object * obj) +{ + mp_media_list_h *svc_handle = (mp_media_list_h *) data; + MP_CHECK(svc_handle); + IF_FREE(svc_handle); + IF_FREE(g_item_data); +} + +static char *_mp_artist_list_group_index_recently_added_text_get(void *data, + Evas_Object *obj, + const char *part) +{ + char *text = NULL; + if (!g_strcmp0(part, "elm.text")) { + int len = strlen(GET_STR(STR_RECENTLY_ADDED)) + strlen(GET_STR(STR_MP_ARTISTS)) + 2; + text = (char *)malloc(len); + MP_CHECK_NULL(text); + snprintf(text, len, "%s %s", GET_STR(STR_RECENTLY_ADDED), GET_STR(STR_MP_ARTISTS)); + } + + return text; +} + +static void _mp_artist_list_recently_added_play_icon_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + int count = 0, res = 0; + mp_list_item_data_t *item_data = (mp_list_item_data_t *)data; + MP_CHECK(item_data); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + mp_media_info_h track = item_data->handle; + MP_CHECK(track); + + MpArtistDetailList_t *list = calloc(1, sizeof(MpArtistDetailList_t)); + MP_CHECK(list); + + mp_media_list_h svc_handle; + mp_plst_item *plst_item = NULL; + char *title = NULL; + char *artist = NULL; + char *thumbnail = NULL; + mp_media_info_group_get_main_info(track, &title); + mp_media_info_group_get_thumbnail_path(track, &thumbnail); + DEBUG_TRACE("thumbnail = %s", thumbnail); + + list->list_type = MP_LIST_TYPE_ARTIST_DETAIL; + list->track_type = MP_GROUP_BY_ARTIST_ALBUM; + list->group_type = MP_TRACK_BY_ARTIST_ALBUM; + list->type_str = title; + + PROFILE_IN("mp_media_info_list_count"); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); + PROFILE_OUT("mp_media_info_list_count"); + + PROFILE_IN("mp_media_info_list_create"); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); + PROFILE_OUT("mp_media_info_list_create"); + IF_FREE(list); + + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + + char *uri = NULL; + char *uid = NULL; + item = mp_media_info_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_list_nth_item, index[%d]", index); + continue; + } + mp_track_type track_type = MP_TRACK_URI; + mp_media_info_get_media_id(item, &uid); + mp_media_info_get_file_path(item, &uri); + mp_media_info_get_title(item, &title); + mp_media_info_get_artist(item, &artist); + + if (!ad->playlist_mgr) { + mp_common_create_playlist_mgr(); + } + MP_CHECK(ad->playlist_mgr); + + PROFILE_IN("mp_playlist_mgr_clear"); + mp_playlist_mgr_clear(ad->playlist_mgr); + PROFILE_OUT("mp_playlist_mgr_clear"); + + if (!index) { + plst_item = + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); + } else { + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); + } + } + + ad->hide_player_view = true; + ad->paused_by_user = false; + + if (ad->playlist_mgr->shuffle_state) { + ad->playlist_mgr->list = ad->playlist_mgr->shuffle_list; + } else { + ad->playlist_mgr->list = ad->playlist_mgr->normal_list; + } + + mp_playlist_mgr_set_current(ad->playlist_mgr, plst_item); + + PROFILE_IN("mp_play_destory"); + mp_play_fast_destory(ad); + PROFILE_OUT("mp_play_destory"); + + mp_play_new_file(ad, TRUE); +} + +static void _mp_artist_list_recently_added_thumbpath_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + mp_list_item_data_t *item = (mp_list_item_data_t *)data; + MP_CHECK(item); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + Evas_Object* genlist = evas_object_data_get(obj, "genlist_obj"); + MP_CHECK(genlist); + + MpArtistList_t *list = evas_object_data_get(genlist, "list_data"); + MP_CHECK(list); + + mp_media_info_h track = item->handle; + MP_CHECK(track); + + int ret = 0; + int index = 0; + char *name = NULL; + char *thumbnail = NULL; + + index = item->index; + + if (index >= 0) { + ret = mp_media_info_group_get_main_info(track, &name); + mp_media_info_group_get_thumbnail_path(track, + &thumbnail); + mp_retm_if(ret != 0, "Fail to get value"); + mp_retm_if(name == NULL, "Fail to get value"); + } + + if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { + MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); + MP_CHECK(view_manager); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); + MP_CHECK(view_select_track); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + int count = g_list_length(ad->checkedList); + if (count > 0) { + char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); + mp_view_set_title((MpView_t *) view_select_track, text); + IF_FREE(text); + } else { + mp_view_set_title((MpView_t *) view_select_track, STR_MP_TILTE_SELECT_ITEM); + } + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ARTIST, MP_TRACK_LIST_TYPE_STR, + name, -1); + mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, + true); + mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, + MP_DONE_SELECT_ADD_TRACK_TYPE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); + mp_list_update(view_select_track->content_to_show); + mp_view_update_options((MpView_t *) view_select_track); + mp_list_set_edit(view_select_track->content_to_show, TRUE); + return; + } + + if (list->edit_mode) { + mp_list_edit_mode_sel((MpList_t *) list, item); + + MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); + MpView_t *view = mp_view_mgr_get_top_view(view_mgr); + ERROR_TRACE("update options of edit view"); + mp_view_update_options_edit((MpView_t *) view); + return; + } + + /* create the view of artist detail */ + MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); + MP_CHECK(view_manager); + MpArtistDetailView_t *view_artist_detail = + mp_artist_detail_view_create(view_manager->navi, name, thumbnail); + MP_CHECK(view_artist_detail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_artist_detail, + NULL); + mp_view_update_options((MpView_t *) view_artist_detail); + mp_view_set_title((MpView_t *) view_artist_detail, name); +} + +static char *_mp_artist_list_recently_added_text_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h *svc_handle = (mp_media_list_h *) data; + MP_CHECK_NULL(svc_handle); + + MpArtistList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + + int count = (list->artist_list_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->artist_list_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *title = NULL; + char *artist = NULL; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_group_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", "elm.text.main.", (index+1)); + if (!g_strcmp0(part, part_name)) { + mp_media_info_group_get_main_info(item, &title); + if (!title || !strlen(title)) { + title = GET_SYS_STR("IDS_COM_BODY_UNKNOWN"); + } + return g_strdup(title); + } + } + return NULL; +} + +static Evas_Object *_mp_artist_list_recently_added_content_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h *svc_handle = (mp_media_list_h *) data; + MP_CHECK_NULL(svc_handle); + + MpArtistList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + int count = (list->artist_list_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->artist_list_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *thumb_path = NULL; + char default_thumbnail[1024] = { 0 }; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_group_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + mp_media_info_group_get_thumbnail_path(item, &thumb_path); + if (!thumb_path) { + char *shared_path = app_get_shared_resource_path(); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); + free(shared_path); + thumb_path = default_thumbnail; + } + + mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + MP_CHECK_NULL(item_data); + item_data->handle = item; + item_data->index = index; + item_data->group_type = MP_GROUP_NONE; + if (g_item_data) { + free(g_item_data); + } + g_item_data = item_data; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", + "elm.swallow.", (index+1)); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, thumb_path, NULL); + elm_image_fill_outside_set(image, true); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_artist_list_recently_added_thumbpath_clicked_cb, NULL); + return content; + } + part_name[0] = '\0'; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d%s", "elm.swallow.", (index+1), ".play"); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + char play_thumbnail[1024] = { 0 }; + char *shared_path = app_get_shared_resource_path(); + snprintf(play_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", RECENTLY_ADDED_PLAY_ICON); + free(shared_path); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, play_thumbnail, NULL); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_artist_list_recently_added_play_icon_clicked_cb, item_data); + return content; + } + } + return NULL; +} + +static Elm_Object_Item *_mp_artist_list_append_group_index(void *thiz) +{ + startfunc; + MpArtistList_t *list = thiz; + MP_CHECK_NULL(list); + MP_CHECK_NULL(list->recently_added_genlist); + + Elm_Object_Item *group_index = NULL; + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK_NULL(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_group_index_recently_added, item_data, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + group_index = item_data->it; + elm_genlist_item_select_mode_set(group_index, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + return group_index; +} + +static void _mp_artist_list_append_recently_added(void *thiz, mp_media_list_h svc_handle) +{ + startfunc; + MpArtistList_t *list = thiz; + MP_CHECK(list); + MP_CHECK(list->recently_added_genlist); + mp_list_item_data_t *item_data; + + item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_genlist_recently_added, svc_handle, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); +} + +static void mp_artist_list_show_recently_added_tracks(void *thiz) +{ + startfunc; + MP_CHECK(thiz); + MpArtistList_t *list = thiz; + int count = 0, res = 0; + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + if (!list->itc_group_index_recently_added) { + list->itc_group_index_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_group_index_recently_added); + list->itc_group_index_recently_added->item_style = "group_index"; + list->itc_group_index_recently_added->func.text_get = + _mp_artist_list_group_index_recently_added_text_get; + list->itc_group_index_recently_added->func.content_get = + NULL; + list->itc_group_index_recently_added->func.del = + _mp_artist_list_recently_added_del_cb; + } + + _mp_artist_list_append_group_index(list); + + if (!list->itc_genlist_recently_added) { + list->itc_genlist_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_genlist_recently_added); + list->itc_genlist_recently_added->item_style = "recently_added"; + list->itc_genlist_recently_added->func.text_get = + _mp_artist_list_recently_added_text_get; + list->itc_genlist_recently_added->func.content_get = + _mp_artist_list_recently_added_content_get; + list->itc_genlist_recently_added->func.del = + _mp_artist_list_recently_added_del_cb; + } + + mp_media_list_h svc_handle = NULL; + + list->track_type = MP_TRACK_BY_ADDED_TIME; + list->playlist_id = 0; + + PROFILE_IN("mp_media_info_group_list_count"); + res = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &count); + PROFILE_OUT("mp_media_info_group_list_count"); + MP_CHECK(res == 0); + list->artist_list_count = count; + + PROFILE_IN("mp_media_info_group_list_create"); + res = + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, + list->type_str, list->filter_str, + 0, count); + PROFILE_OUT("mp_media_info_group_list_create"); + MP_CHECK(svc_handle); + + PROFILE_IN("_mp_artist_list_append_recently_added"); + _mp_artist_list_append_recently_added(list, svc_handle); + PROFILE_OUT("_mp_artist_list_append_recently_added"); +} void _mp_artist_list_update(void *thiz) { @@ -663,18 +1108,24 @@ void _mp_artist_list_update(void *thiz) MP_CHECK(ad); res = - mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, - list->filter_str, &count); + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &count); MP_CHECK(res == 0); mp_list_free_checked_path_list(list->checked_path_list); list->checked_path_list = - mp_list_get_checked_path_list((MpList_t *) list); + mp_list_get_checked_path_list((MpList_t *) list); mp_evas_object_del(list->genlist); mp_evas_object_del(list->no_content); if (count) { + // Place Recently Added Grid View only when there are some items in genlist + if (ad->recentlyAddedGridView) { + mp_artist_list_initialize_recently_added(list); + } + + /*create new genlist */ if (list->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_artist_list_gengrid_create(list); } else { @@ -684,6 +1135,10 @@ void _mp_artist_list_update(void *thiz) evas_object_data_set(list->genlist, "list_handle", list); if (!list->edit_mode) { + if (ad->recentlyAddedGridView) { + mp_artist_list_show_recently_added_tracks(list); + ad->recentlyAddedGridView = false; + } mp_list_bottom_counter_item_append((MpList_t *) list); } @@ -692,8 +1147,8 @@ void _mp_artist_list_update(void *thiz) list->show_fastscroll(list); } else { list->no_content = - mp_widget_create_no_contents(list->box, MP_NOCONTENT_ARTISTS, - NULL, list); + mp_widget_create_no_contents(list->box, MP_NOCONTENT_ARTISTS, + NULL, list); list->hide_fastscroll(list); elm_box_pack_end(list->box, list->no_content); @@ -732,9 +1187,9 @@ static char *_mp_artist_list_bottom_counter_text_cb(void *thiz) MP_CHECK_NULL(list); unsigned int count = - mp_list_get_editable_count((MpList_t *) list, - mp_list_get_edit_type((MpList_t *) - list)); + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -759,7 +1214,6 @@ static void _mp_artist_list_set_edit(void *thiz, bool edit) } } - static unsigned int _mp_artist_list_get_count(void *thiz, MpListEditType_e type) { diff --git a/src/widget/mp-lyric.c b/src/widget/mp-lyric.c index 6fda3d8..6e7662d 100644 --- a/src/widget/mp-lyric.c +++ b/src/widget/mp-lyric.c @@ -352,6 +352,7 @@ Evas_Object *mp_lyric_create(Evas_Object * parent, const char *path) wd = calloc(1, sizeof(MpLyricData_t)); if (!wd) { + mp_lyric_mgr_destory(lyric_mgr); return NULL; } diff --git a/src/widget/mp-playlist-list.c b/src/widget/mp-playlist-list.c index a703b9b..9771ea7 100644 --- a/src/widget/mp-playlist-list.c +++ b/src/widget/mp-playlist-list.c @@ -484,8 +484,6 @@ static void _mp_playlist_list_set_edit(void *thiz, bool edit) mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_ALWAYS); - //mp_list_bottom_counter_item_append((MpList_t *)list); - _mp_playlist_append_user_playlists(list, NULL); } } @@ -878,12 +876,6 @@ static void _mp_playlist_list_load_list(void *thiz, int count_auto, _mp_playlist_append_user_playlists(list, group_index); } - /*if (!list->edit_mode) - _mp_playlist_append_add_playlist(list, group_index); */ - - /*if (count_user) - mp_list_bottom_counter_item_append((MpList_t *)list); */ - endfunc; } @@ -985,10 +977,10 @@ static char *_mp_playlist_genlist_group_index_default_text_get(void *data, } static char *_mp_playlist_genlist_group_index_user_text_get(void *data, - Evas_Object * - obj, - const char - *part) + Evas_Object * + obj, + const char + *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -1050,17 +1042,8 @@ static void _mp_playlist_list_genlist_create(MpPlaylistList_t * list) /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - //evas_object_smart_callback_add(list->genlist, "longpressed", _mp_playlist_list_item_longpressed_cb, list); evas_object_data_set(list->genlist, "list_data", list); - /* current not used - if (!list->itc_user) - list->itc_user = elm_genlist_item_class_new(); - list->itc_user->item_style = "music/musiclist/2text.1icon"; - list->itc_user->func.text_get = _mp_playlist_list_label_get; - list->itc_user->func.content_get = _mp_playlist_list_icon_get; - list->itc_user->func.del = _mp_playlist_list_item_del_cb; */ - if (!list->itc_auto) { list->itc_auto = elm_genlist_item_class_new(); MP_CHECK(list->itc_auto); @@ -1120,8 +1103,6 @@ static void _mp_playlist_list_update(void *thiz) mp_evas_object_del(list->no_content); mp_evas_object_del(list->genlist); - //if (count_auto + count_user) - //{ if (list->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_playlist_list_gengrid_create(list); } else { @@ -1131,20 +1112,6 @@ static void _mp_playlist_list_update(void *thiz) /* load list */ _mp_playlist_list_load_list(thiz, count_auto, count_user); - - //} - /* - else - { - DEBUG_TRACE("count is 0"); - if (!list->no_content) - { - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_PLAYLIST, NULL, NULL); - elm_box_pack_end(list->box, list->no_content); - } - } - */ - } static unsigned int diff --git a/src/widget/mp-track-list.c b/src/widget/mp-track-list.c index 9a32296..172fabb 100644 --- a/src/widget/mp-track-list.c +++ b/src/widget/mp-track-list.c @@ -26,12 +26,15 @@ #include "mp-edit-callback.h" #include "mp-player-mgr.h" #include "mp-minicontroller.h" +#include "mp-playlist-detail-view.h" #include #include #define INITIAL_LOAD_COUNT 8 #define ALBUMART_INDEX_SIZE (720 * elm_config_scale_get()) +static mp_list_item_data_t* g_item_data = NULL; + typedef struct { char *name; char *path; @@ -39,7 +42,7 @@ typedef struct { } albumart_info_s; static char *_mp_track_list_label_get(void *data, Evas_Object * obj, - const char *part) + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -289,7 +292,7 @@ _mp_track_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) if (!list->reorderable) { mp_common_play_track_list_with_playlist_id(item, obj, - list->playlist_id); + list->playlist_id); } return; @@ -318,9 +321,9 @@ _mp_track_list_albumart_index_list_destroy(MpTrackList_t * list) static void _mp_track_list_albumart_index_shortcut_clicked_cb(void *data, - Evas_Object * obj, - const char *emission, - const char *source) + Evas_Object * obj, + const char *emission, + const char *source) { MpTrackList_t *list = data; MP_CHECK(list); @@ -351,11 +354,11 @@ _mp_track_list_albumart_index_shortcut_clicked_cb(void *data, } static Evas_Object *_mp_track_list_albumart_index_contnet_get_cb(void - *data, - Evas_Object - *obj, - const char - *part) + *data, + Evas_Object + *obj, + const char + *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -475,10 +478,9 @@ _mp_track_list_albumart_index_list_append(MpTrackList_t * list, snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); free(shared_path); - path = g_strdup(default_thumbnail); + path = default_thumbnail; } MP_CHECK(path); - //mp_debug("path = %s", path); album = calloc(1, sizeof(albumart_info_s)); MP_CHECK(album); @@ -559,8 +561,8 @@ MpCloudView_e mp_track_list_get_cloud_view(MpTrackList_t * list) } static void _mp_track_list_append_item(MpTrackList_t * list, - mp_media_list_h svc_handle, - int count) + mp_media_list_h svc_handle, + int count) { struct appdata *ad = mp_util_get_appdata(); @@ -577,7 +579,7 @@ static void _mp_track_list_append_item(MpTrackList_t * list, if (mp_util_is_in_personal_page((const char *) path)) { if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD - || !mp_util_is_personal_page_on()) { + || !mp_util_is_personal_page_on()) { DEBUG_TRACE("ignore the items out of personal storage"); continue; } @@ -610,14 +612,14 @@ static void _mp_track_list_append_item(MpTrackList_t * list, } } else { item_data->checked = - mp_list_is_in_checked_path_list(list->checked_path_list, - file_path); + mp_list_is_in_checked_path_list(list->checked_path_list, + file_path); } item_data->it = - elm_genlist_item_append(list->genlist, list->itc, item_data, - NULL, ELM_GENLIST_ITEM_NONE, - _mp_track_genlist_sel_cb, list); + elm_genlist_item_append(list->genlist, list->itc, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _mp_track_genlist_sel_cb, list); elm_object_item_data_set(item_data->it, item_data); } endfunc; @@ -766,8 +768,7 @@ static void _mp_track_list_append_shuffle_item(MpTrackList_t * list) if (list->itc_shuffle == NULL) { list->itc_shuffle = elm_genlist_item_class_new(); MP_CHECK(list->itc_shuffle); - //list->itc_shuffle->item_style = "music/1line";//"music/3text.1icon.2" - list->itc_shuffle->item_style = "default"; //"music/3text.1icon.2" + list->itc_shuffle->item_style = "default"; list->itc_shuffle->func.text_get = _mp_track_list_shuffle_text_get; list->itc_shuffle->decorate_all_item_style = NULL; list->itc_shuffle->func.content_get = @@ -835,12 +836,333 @@ void mp_track_list_update_genlist(void *thiz) } } +static void mp_track_list_initialize_recently_added(MpTrackList_t *list) +{ + MP_CHECK(list); + + mp_evas_object_del(list->recently_added_genlist); + list->recently_added_genlist = mp_widget_genlist_create(list->box); + MP_CHECK(list->recently_added_genlist); + elm_scroller_policy_set(list->recently_added_genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->recently_added_genlist, EVAS_HINT_EXPAND, + 0.5); + evas_object_size_hint_align_set(list->recently_added_genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_genlist_mode_set(list->recently_added_genlist, ELM_LIST_COMPRESS); + evas_object_show(list->recently_added_genlist); + /*packet genlist to box */ + elm_box_pack_end(list->box, list->recently_added_genlist); + + evas_object_data_set(list->recently_added_genlist, "list_data", list); +} + +void _mp_track_list_recently_added_del_cb(void *data, Evas_Object * obj) +{ + mp_media_list_h *svc_handle = (mp_media_list_h *) data; + MP_CHECK(svc_handle); + IF_FREE(svc_handle); + IF_FREE(g_item_data); +} + +char *_mp_track_list_group_index_recently_added_text_get(void *data, + Evas_Object *obj, + const char *part) +{ + char *text = NULL; + if (!g_strcmp0(part, "elm.text")) { + int len = strlen(GET_STR(STR_RECENTLY_ADDED)) + strlen(GET_STR(STR_MP_ARTISTS)) + 2; + text = (char *)malloc(len); + MP_CHECK_NULL(text); + snprintf(text, len, "%s %s", GET_STR(STR_RECENTLY_ADDED), GET_STR(STR_MP_TRACKS)); + } + + return text; +} + +static void _mp_track_list_recently_added_play_icon_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + mp_list_item_data_t *item = (mp_list_item_data_t *)data; + MP_CHECK(item); + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + Evas_Object* genlist = evas_object_data_get(obj, "genlist_obj"); + MP_CHECK(genlist); + + mp_media_info_h track = item->handle; + MP_CHECK(track); + + char *uri = NULL; + char *uid = NULL; + mp_media_info_get_file_path(track, &uri); + mp_media_info_get_media_id(track, &uid); + + mp_common_play_track_list_with_song_uid(item, genlist, uid, uri); +} + +static void _mp_track_list_recently_added_thumbpath_clicked_cb(void *data, + Evas_Object * obj, const char *emission, const char *source) +{ + startfunc; + mp_track_type_e type = MP_TRACK_BY_ADDED_TIME; + char *name = g_strdup(STR_MP_RECENTLY_ADDED); + MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); + MpPlaylistDetailView_t *view_plst_detail = mp_playlist_detail_view_create(view_manager->navi, type, name, mp_media_info_get_auto_playlist_id_by_name(name)); + mp_view_mgr_push_view(view_manager, (MpView_t *)view_plst_detail, NULL); + + mp_view_update_options((MpView_t *)view_plst_detail); + mp_view_set_title((MpView_t *)view_plst_detail, name); +} + +char *_mp_track_list_recently_added_text_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h svc_handle = (mp_media_list_h) data; + MP_CHECK_NULL(svc_handle); + + MpTrackList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + + int count = (list->track_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->track_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *title = NULL; + char *artist = NULL; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", "elm.text.main.", (index+1)); + if (!g_strcmp0(part, part_name)) { + mp_media_info_get_title(item, &title); + if (!title || !strlen(title)) { + title = GET_SYS_STR("IDS_COM_BODY_UNKNOWN"); + } + return g_strdup(title); + } + part_name[0] = '\0'; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", "elm.text.sub.", (index+1)); + if (!g_strcmp0(part, part_name)) { + mp_media_info_get_artist(item, &artist); + if (!artist || !strlen(artist)) { + artist = GET_SYS_STR("IDS_COM_BODY_UNKNOWN"); + } + return g_strdup(artist); + } + } + return NULL; +} + +Evas_Object *_mp_track_list_recently_added_content_get(void *data, Evas_Object * obj, const char *part) +{ + mp_media_list_h svc_handle = (mp_media_list_h) data; + MP_CHECK_NULL(svc_handle); + + MpTrackList_t *list = evas_object_data_get(obj, "list_data"); + MP_CHECK_NULL(list); + int count = (list->track_count < RECENTLY_ADDED_TRACKS_MAX_COUNT) ? list->track_count : RECENTLY_ADDED_TRACKS_MAX_COUNT; + for (int index = 0; index < count; index++) { + mp_media_info_h item = NULL; + char *thumb_path = NULL; + char part_name[RECENTLY_ADDED_PART_NAME_MAX_SIZE] = {0, }; + + item = mp_media_info_list_nth_item(svc_handle, index); + if (!item) { + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, index[%d]", index); + return NULL; + } + mp_media_info_get_thumbnail_path(item, &thumb_path); + if (!thumb_path) { + char default_thumbnail[1024] = { 0 }; + char *shared_path = app_get_shared_resource_path(); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); + free(shared_path); + thumb_path = g_strdup(default_thumbnail); + } + + mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + MP_CHECK_NULL(item_data); + item_data->handle = item; + item_data->index = index; + item_data->group_type = MP_GROUP_NONE; + if (g_item_data) { + free(g_item_data); + } + g_item_data = item_data; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d", + "elm.swallow.", (index+1)); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, thumb_path, NULL); + elm_image_fill_outside_set(image, true); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_track_list_recently_added_thumbpath_clicked_cb, NULL); + return content; + } + part_name[0] = '\0'; + snprintf(part_name, RECENTLY_ADDED_PART_NAME_MAX_SIZE, "%s%d%s", "elm.swallow.", (index+1), ".play"); + if (!g_strcmp0(part, part_name)) { + Evas_Object *content = NULL; + content = elm_layout_add(obj); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + char play_thumbnail[1024] = { 0 }; + char *shared_path = app_get_shared_resource_path(); + snprintf(play_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", RECENTLY_ADDED_PLAY_ICON); + free(shared_path); + Evas_Object* image = elm_image_add(obj); + elm_image_file_set(image, play_thumbnail, NULL); + elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(image); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); + elm_layout_content_set(content, "elm.swallow.content", image); + evas_object_data_set(content, "genlist_obj", list->genlist); + elm_object_signal_callback_add(content, "mouse,clicked,1", "*", + _mp_track_list_recently_added_play_icon_clicked_cb, item_data); + return content; + } + } + return NULL; +} + +static Elm_Object_Item *_mp_track_list_append_group_index(void *thiz) +{ + startfunc; + MpTrackList_t *list = thiz; + MP_CHECK_NULL(list); + MP_CHECK_NULL(list->recently_added_genlist); + + Elm_Object_Item *group_index = NULL; + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK_NULL(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_group_index_recently_added, item_data, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + group_index = item_data->it; + elm_genlist_item_select_mode_set(group_index, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + return group_index; +} + +static void _mp_track_list_append_recently_added(void *thiz, mp_media_list_h svc_handle) +{ + startfunc; + MpTrackList_t *list = thiz; + MP_CHECK(list); + MP_CHECK(list->recently_added_genlist); + mp_list_item_data_t *item_data; + + item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + MP_CHECK(item_data); + item_data->it = + elm_genlist_item_append(list->recently_added_genlist, list->itc_genlist_recently_added, svc_handle, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); +} + +static void mp_track_list_show_recently_added_tracks(void *thiz) +{ + startfunc; + MP_CHECK(thiz); + MpTrackList_t *list = thiz; + int count = 0, res = 0; + + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + + if (!list->itc_group_index_recently_added) { + list->itc_group_index_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_group_index_recently_added); + list->itc_group_index_recently_added->item_style = "group_index"; + list->itc_group_index_recently_added->func.text_get = + _mp_track_list_group_index_recently_added_text_get; + list->itc_group_index_recently_added->func.content_get = + NULL; + list->itc_group_index_recently_added->func.del = + _mp_track_list_recently_added_del_cb; + } + + _mp_track_list_append_group_index(list); + + if (!list->itc_genlist_recently_added) { + list->itc_genlist_recently_added = elm_genlist_item_class_new(); + MP_CHECK(list->itc_genlist_recently_added); + list->itc_genlist_recently_added->item_style = "recently_added"; + list->itc_genlist_recently_added->func.text_get = + _mp_track_list_recently_added_text_get; + list->itc_genlist_recently_added->func.content_get = + _mp_track_list_recently_added_content_get; + list->itc_genlist_recently_added->func.del = + _mp_track_list_recently_added_del_cb; + } + + mp_media_list_h svc_handle = NULL; + + list->track_type = MP_TRACK_BY_ADDED_TIME; + list->playlist_id = 0; + + PROFILE_IN("mp_media_info_list_count"); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); + PROFILE_OUT("mp_media_info_list_count"); + MP_CHECK(res == 0); + list->track_count = count; + + PROFILE_IN("mp_media_info_list_create"); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); + PROFILE_OUT("mp_media_info_list_create"); + MP_CHECK(svc_handle); + + PROFILE_IN("_mp_track_list_append_recently_added"); + _mp_track_list_append_recently_added(list, svc_handle); + PROFILE_OUT("_mp_track_list_append_recently_added"); +} + static void _mp_track_list_load_list(void *thiz, int count) { startfunc; MpTrackList_t *list = thiz; MP_CHECK(list); + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + /*media-svc related */ mp_media_list_h svc_handle = NULL; @@ -860,16 +1182,19 @@ static void _mp_track_list_load_list(void *thiz, int count) ecore_timer_add(0.4, _mp_track_list_lazy_load, list); } - /*get data from DB */ PROFILE_IN("mp_media_info_list_create"); mp_media_info_list_create(&svc_handle, list->track_type, - list->type_str, list->type_str2, - list->filter_str, list->playlist_id, 0, - count); + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); PROFILE_OUT("mp_media_info_list_create"); if (!list->edit_mode) { + if (ad->recentlyAddedGridView) { + mp_track_list_show_recently_added_tracks(list); + ad->recentlyAddedGridView = false; + } mp_track_list_show_shuffle(list, true); } @@ -915,12 +1240,15 @@ static void _mp_track_list_destory_cb(void *thiz) list->itc_shuffle = NULL; } + if (list->itc_group_index_recently_added) { + elm_genlist_item_class_free(list->itc_group_index_recently_added); + list->itc_group_index_recently_added = NULL; + } + IF_FREE(list->type_str); IF_FREE(list->type_str2); IF_FREE(list->filter_str); - elm_genlist_item_class_free(list->itc); - _mp_track_list_albumart_index_list_destroy(list); mp_list_free_checked_path_list(list->checked_path_list); @@ -968,15 +1296,19 @@ static void _mp_track_list_item_unhighlighted(void *data, static void _mp_track_list_update(void *thiz) { startfunc; + int count = 0, res = 0; MpTrackList_t *list = thiz; MP_CHECK(list); + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + PROFILE_IN("mp_media_info_list_count"); res = - mp_media_info_list_count(list->track_type, list->type_str, - list->type_str2, list->filter_str, - list->playlist_id, &count); + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); PROFILE_OUT("mp_media_info_list_count"); MP_CHECK(res == 0); list->track_count = count; @@ -989,7 +1321,13 @@ static void _mp_track_list_update(void *thiz) mp_evas_object_del(list->no_content); mp_evas_object_del(list->genlist); + if (count) { + // Place Recently Added Grid View only when there are some items in genlist + if (ad->recentlyAddedGridView) { + mp_track_list_initialize_recently_added(list); + } + /*create new genlist */ PROFILE_IN("elm_genlist_add"); list->genlist = mp_widget_genlist_create(list->box); @@ -1019,20 +1357,20 @@ static void _mp_track_list_update(void *thiz) if (list->reorderable) { evas_object_smart_callback_add(list->genlist, "moved", - mp_list_item_reorder_moved_cb, - list); + mp_list_item_reorder_moved_cb, + list); } evas_object_smart_callback_add(list->genlist, "scroll,drag,start", - list->drag_start_cb, list); + list->drag_start_cb, list); evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", - list->drag_stop_cb, list); + list->drag_stop_cb, list); evas_object_smart_callback_add(list->genlist, "highlighted", - _mp_track_list_item_highlighted, - list); + _mp_track_list_item_highlighted, + list); evas_object_smart_callback_add(list->genlist, "unhighlighted", - _mp_track_list_item_unhighlighted, - list); + _mp_track_list_item_unhighlighted, + list); PROFILE_OUT("elm_genlist_add"); /* load list */ -- 2.7.4