From 1057426058b81a5bfc3180ff18662a836829bb18 Mon Sep 17 00:00:00 2001 From: "bhutani.92" Date: Fri, 10 Jun 2016 15:01:36 +0530 Subject: [PATCH] Added Indicator to Notification Area Change-Id: I48fd9a140fbcaeb5020c6a8ea3a8fee282ea8471 Signed-off-by: bhutani.92 --- music-chooser/src/include/mc-track-list.h | 2 + music-chooser/src/include/music-chooser.h | 2 + music-chooser/src/mc-select-view.c | 3 + music-chooser/src/mc-track-list.c | 49 +++++++++ music-chooser/src/music-chooser.c | 3 + .../T02_control_circle_icon_pause.png | Bin 0 -> 3428 bytes .../shared_images/T02_control_circle_icon_play.png | Bin 0 -> 4033 bytes src/common/include/mp-util.h | 3 + src/common/mp-common.c | 1 + src/common/mp-edit-callback.c | 1 + src/common/mp-util.c | 113 ++++++++++++++++++++- src/core/mp-language-mgr.c | 2 +- src/core/mp-setting-ctrl.c | 3 - src/include/music.h | 4 + src/mp-main.c | 17 ++++ src/view/mp-player-view.c | 2 +- src/view/mp-set-as-view.c | 3 + src/widget/mp-edit-playlist.c | 3 + 18 files changed, 205 insertions(+), 6 deletions(-) create mode 100644 shared/res/shared_images/T02_control_circle_icon_pause.png create mode 100644 shared/res/shared_images/T02_control_circle_icon_play.png diff --git a/music-chooser/src/include/mc-track-list.h b/music-chooser/src/include/mc-track-list.h index a202c33..a5db50c 100644 --- a/music-chooser/src/include/mc-track-list.h +++ b/music-chooser/src/include/mc-track-list.h @@ -19,6 +19,7 @@ #define __MC_TRACK_LIST_H__ #include +#include #include "music-chooser.h" #include "mp-media-info.h" @@ -39,6 +40,7 @@ typedef struct Evas_Object *mc_track_list_create(Evas_Object *parent, struct app_data *ad); +void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e state); int mc_track_list_set_data(Evas_Object *list, int track_type, const char *type_str, int playlist_id); void mc_track_list_set_uri_selected(void *thiz, const char *uri); int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Object *sub_view); diff --git a/music-chooser/src/include/music-chooser.h b/music-chooser/src/include/music-chooser.h index a0133a9..c1f750e 100755 --- a/music-chooser/src/include/music-chooser.h +++ b/music-chooser/src/include/music-chooser.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "mc-debug.h" #include "mp-common-defs.h" @@ -92,6 +93,7 @@ struct app_data Evas_Object *base_layout; Evas_Object *navi_bar; int max_count; + notification_h noti; char *select_uri; ug_type select_type; diff --git a/music-chooser/src/mc-select-view.c b/music-chooser/src/mc-select-view.c index a7800e6..af0b996 100755 --- a/music-chooser/src/mc-select-view.c +++ b/music-chooser/src/mc-select-view.c @@ -319,6 +319,9 @@ _mc_select_view_init(int type, sel_view_data_t *vd) MP_CHECK(vd); itc = elm_genlist_item_class_new(); + if (!itc) { + return; + } itc->func.content_get = mc_group_content_get; switch (type) { case MC_SHORTCUT_ALBUM: diff --git a/music-chooser/src/mc-track-list.c b/music-chooser/src/mc-track-list.c index ca52709..c8680ae 100755 --- a/music-chooser/src/mc-track-list.c +++ b/music-chooser/src/mc-track-list.c @@ -111,6 +111,54 @@ static Evas_Object *_gl_select_all_content_get(void *data, Evas_Object *obj, con return NULL; } +void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e state) +{ + startfunc; + MP_CHECK_NULL(it_data); + struct app_data *ad = it_data->ad; + int ret = 0; + + int applist = NOTIFICATION_DISPLAY_APP_INDICATOR; + notification_type_e noti_type = NOTIFICATION_TYPE_NOTI; + notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; + char *path = app_get_shared_resource_path(); + + //DEBUG_TRACE("Shared Resource Path is %s", path); + char icon_path[1024] = {0}; + + if (state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_IDLE) { + snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_pause.png", path); + } else { + snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", path); + } + free(path); + + if(!ad->noti) { + DEBUG_TRACE("notification create"); + notification_delete_all(NOTIFICATION_TYPE_NOTI); + ad->noti = notification_create(noti_type); + ret = notification_set_image(ad->noti, img_type, icon_path); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the notification image"); + } + ret = notification_set_display_applist(ad->noti, applist); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the display applist"); + notification_free(ad->noti); + return; + } + notification_post(ad->noti); + } else { + ret = notification_set_image(ad->noti, img_type, icon_path); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the notification image"); + } + notification_update(ad->noti); + } + DEBUG_TRACE("Icon Path is: %s", icon_path); + endfunc; +} + static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part) { char *thumbpath = NULL; @@ -153,6 +201,7 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa } else { elm_object_signal_emit(part_content, "show_pause", "*"); } + mc_post_notification_indicator(it_data, state); //elm_object_item_signal_emit(cur_item_data->it, "show_color" ,"*"); } diff --git a/music-chooser/src/music-chooser.c b/music-chooser/src/music-chooser.c index 24654e8..6a6525f 100755 --- a/music-chooser/src/music-chooser.c +++ b/music-chooser/src/music-chooser.c @@ -344,6 +344,9 @@ mc_destroy(void *data) ecore_pipe_del(ad->smat_pipe); ad->smat_pipe = NULL; } + + notification_delete(ad->noti); + notification_free(ad->noti); } } diff --git a/shared/res/shared_images/T02_control_circle_icon_pause.png b/shared/res/shared_images/T02_control_circle_icon_pause.png new file mode 100644 index 0000000000000000000000000000000000000000..5f9007d6d7c5095c1fedb6e92d8b0f3f35a85d86 GIT binary patch literal 3428 zcma);XD}T67RLWV^j;&%s}s?CFS~jTRt(9`cNpB&m$z<}kN76=0nXV^oCL2as4B@2v z7TMF)y|gN(5l+tM187NWT)F+uc?rOAsEW#Mo;H#eKoB@aK?>T8v)d%tV=ienA({6G z!d?)x`6nwFl7=w?ji5wGA<)nv2t#KGSb#ht;5gvoyaMis0!P8;-^V~0`ZzO~0NB0e zW+KQ-23!nov0A`g8I3BU+9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2J7<=_Jn4 literal 0 HcmV?d00001 diff --git a/shared/res/shared_images/T02_control_circle_icon_play.png b/shared/res/shared_images/T02_control_circle_icon_play.png new file mode 100644 index 0000000000000000000000000000000000000000..81ef0459206a6a23419314b337e34cfca1c3f0c6 GIT binary patch literal 4033 zcmZ{mRaDds*Tw%scS$2WAl(hp-6h=;!VDpe4k0ljB?MDTZ(vrV=CHDZ5V z+aLfSz4xy`K+Xq703b2()X;eJ$ipw#FUZ5spIuKwgWW&S5A6BW9RNb+5#|sJ^IdwS z^W{@@gM{e!27YFAMC@kjNzt^aJOUiVRQd@Vg=jj{PHHVJJeGli1l;80=r?qxLS(N= z<_I@AJ|@R}N_ahZwHE%#d#3gL=g4jStnzjR7EwD&h$JG*)Ri=qjwUNrXQN(?>F?=V z+Z0iSk#P9~R7ACI96>jnAmAcWQBm*#lCT{Bg-ntX0Z5}+j4pfi| zu-|h}&;&dbfQnJ8*IIy$7(fd)=#c~FgaI)8z$-XFt9@dv_)D;gYFprMQt%qZCN4QGm_3nj0HL+D2pbE|>&ETYXt}>C0IUT^j^7H2 z)-p#c5Jdaje&ojBc|0a9cy^uyuAx+|2MTuQt+D?9W}{X3t_h9a+T5Je?@_mR8MKbL zg>*R~t#6)QMk-#PpRKm9bHOAWVLEsht6jsVhDG;B(}-WWF8)l>xo#xAyJnqy(4*(t zWFtVkVM-H_teNu$D^c_yQ9X^nmwV#QZGA=P3RihW8mRVC28E{zmpDGb{cXTYWfP2C zKL>!57QfCZJ|f&`kC?Sl=-rXZjZOhK5DnH#3jlz}np`3lgS9ICL;#>!028QIV>#_) z6hac*@5Ep1B)xW)d8N+P)1^+OPU04QKhT-K;-xxY+(gO@8cij#%&)XRl8(6ri|3@! z7vzow)-fx+kty6BEBBzBPf^zB7enqa5=!g^;?L^itlG{!ztl@mNo(n z0x#%N2T3yYGk7vs1Vk-L%f6H?myudxEr%>pN*|j?RB2mEns1a6Pi2-{mLVSPo3ofh zN)<}t%OE9w7Al`3ZEq3@Y`Y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W`|$9xSS{Fe7W5q+d%J($>Fm!sW-E~KXZUH$cUHL~Ss58+A27ek2jW1SIyunA=Xj~kq%PKkfh^kJL1DjZ_kE}c; zQL8aYthxzKzd(k53S5cTUx$Ps=4%lNzS=N8X@5!=eP$`5O)o$gq_x`iSckOZ)nZ}Z*A@T8<9URVlD z8V6e7|FD%JAuLbU3;Z?LR&~|)DK;e+P3=53EJL&i%T$hvDs&K`grmb?3TAw?VaHRY z=Ay)lg*E5{P8=xTD0UDB`gwWz@%pa|beY_v*PC~qFJ64mh^H8zo}P}nJlU#4?$;S) ziHxJsdQd17bA5>=jDA?nek^~mGybWrv2hfk93f8;jKffdQNj^lvTZ*~9|5DAf_OPO zIhA@{1G3=m<$KAdFj12xhvX1N-)}ZT_5vBoIPKE4yRRiL*W;pzHRPEjf8h(BJd;p{IZYywK=?W4jF5mJ4GEIGDqQa4J1*J}mSW~c7)MDe zDJ}I)`;|>?*&qn=b8;TQ4JT%1WK8*JA0Pvq8}j-OxGpjTt#=L&-AD73I`ZX$ctCYH zQQyU$ZzCsnr3fk691f0-?wIHBuXiRc5TMbmz`DA+cgDr>B(Yt}tFMw;?2TephI!3u zYiompgQ=2wPZ&fWU(@cCpYI1Ry%ZG^y52Vp^Yu**mN$}OMyNnB4hq(OXTlHf(mrS2 zHDQjAkKZ^J7Z!3XG(YpE-T|?-FksCpu?~}~sk)oRmzS3vh5h~gKK;q8GgDJi!_)Sm zM`-mDt7BE+j?S^g#cRwLqg*>#zvWhm+!2X~53`51vH2h;P_F{M6AG(UKOAHfLx=;j zL}CrfF{>G|LsUXPs>=d JO5OS8{{Z-7oaX=l literal 0 HcmV?d00001 diff --git a/src/common/include/mp-util.h b/src/common/include/mp-util.h index 75c5685..a2af58e 100755 --- a/src/common/include/mp-util.h +++ b/src/common/include/mp-util.h @@ -66,6 +66,7 @@ Evas_Object * mp_util_create_selectioninfo_with_count(void *data, int count); void mp_util_post_status_message(struct appdata *ad, const char *text); void mp_util_post_add_to_playlist_popup_message(int count); char * mp_util_get_new_playlist_name (void); +void mp_post_notification_indicator(char *status); mp_file_delete_err_t mp_util_delete_track(void *data, char *fid, char *file_path); int mp_util_share_via_bt(const char *formed_path, int file_cnt); @@ -76,8 +77,10 @@ char* mp_util_isf_get_edited_str(Evas_Object *isf_entry, bool permit_first_bl int mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_handle); bool mp_util_set_screen_mode(void *data , int mode); +void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); bool mp_util_launch_browser(const char *url, struct appdata *ad); +const char *util_get_file_path(const char *relative); #define mp_object_free(obj) \ diff --git a/src/common/mp-common.c b/src/common/mp-common.c index c9b4b5f..9eb473d 100755 --- a/src/common/mp-common.c +++ b/src/common/mp-common.c @@ -1666,6 +1666,7 @@ _mp_common_multiple_view_operation(app_control_h app_control) for (i = 0; i < length; i++) { char *path = _mp_util_convert_url(value[i]); mp_plst_item *item = mp_playlist_mgr_item_append(ad->playlist_mgr, path, NULL, NULL, NULL, MP_TRACK_URI); + MP_CHECK(item); if (thumbs) { item->thumbnail_path = g_strdup(thumbs[i]); } diff --git a/src/common/mp-edit-callback.c b/src/common/mp-edit-callback.c index 0c87e8f..086dc9f 100755 --- a/src/common/mp-edit-callback.c +++ b/src/common/mp-edit-callback.c @@ -268,6 +268,7 @@ _mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_i //set selection info && update buttons MpListView_t *view = (MpListView_t *)mp_view_mgr_get_top_view(GET_VIEW_MGR); + MP_CHECK(view); bool list_view = false; mp_list_view_is_list_view(view, &list_view); if (list_view && mp_list_get_edit(view->content_to_show)) { diff --git a/src/common/mp-util.c b/src/common/mp-util.c index 6df5d70..13da376 100755 --- a/src/common/mp-util.c +++ b/src/common/mp-util.c @@ -48,6 +48,7 @@ bool track_deleted = false; #define SINGLE_BYTE_MAX 0x7F +#define PATH_MAX 4096 struct index_s { const char *index; @@ -860,7 +861,7 @@ mp_util_get_title_from_path(const char *path) bool mp_util_is_playlist_name_valid(char *name) { - MP_CHECK_NULL(name); + MP_CHECK_FALSE(name); char *test_space = strdup(name); if (strlen(g_strchug(test_space)) == 0) { @@ -920,6 +921,7 @@ mp_util_reset_genlist_mode_item(Evas_Object *genlist) elm_genlist_item_decorate_mode_set(gl_item, "slide", EINA_FALSE); elm_genlist_item_select_mode_set(gl_item, ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_item_data_t *item_data = elm_object_item_data_get(gl_item); + MP_CHECK(item_data); item_data->checked = true; } } @@ -2599,3 +2601,112 @@ mp_dir_e mp_util_get_file_location(const char *uri) } +const char *util_get_file_path(const char *relative) +{ + startfunc; + static char buf[PATH_MAX]; + char *prefix = app_get_shared_resource_path(); + if (!prefix) { + return NULL; + } + + DEBUG_TRACE("Shared Path is: %s", prefix); + + size_t res = eina_file_path_join(buf, sizeof(buf), prefix, relative); + free(prefix); + if (res > sizeof(buf)) { + DEBUG_TRACE("Path exceeded PATH_MAX"); + return NULL; + } + + if (!ecore_file_exists(&buf[0])) + { + DEBUG_TRACE("icon file does not exist!!: %s", &buf[0]); + return NULL; + } + return &buf[0]; +} + + +void mp_post_notification_indicator(char *status) +{ + startfunc; + + struct appdata *ad = mp_util_get_appdata(); + int ret = 0; + + int applist = NOTIFICATION_DISPLAY_APP_INDICATOR; + notification_type_e noti_type = NOTIFICATION_TYPE_NOTI; + notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; + char *path = app_get_shared_resource_path(); + + //DEBUG_TRACE("Shared Resource Path is %s", path); + char icon_path[1024] = {0}; + + if (!strcmp(status, "playing")) { + snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_pause.png", path); + } else { + snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", path); + } + free(path); + + if(!ad->noti) { + DEBUG_TRACE("notification create"); + notification_delete_all(NOTIFICATION_TYPE_NOTI); + ad->noti = notification_create(noti_type); + ret = notification_set_image(ad->noti, img_type, icon_path); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the notification image"); + } + ret = notification_set_display_applist(ad->noti, applist); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the display applist"); + notification_free(ad->noti); + return; + } + notification_post(ad->noti); + } else { + ret = notification_set_image(ad->noti, img_type, icon_path); + if (ret != NOTIFICATION_ERROR_NONE) { + DEBUG_TRACE("Cannot set the notification image"); + } + notification_update(ad->noti); + } + DEBUG_TRACE("Icon Path is: %s", icon_path); + endfunc; +} + +void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) +{ + startfunc; + DEBUG_TRACE("Path of file monitor is: %s", path); + if (!path) { + DEBUG_TRACE("Invalid path information"); + return; + } + char str[1000] = {0,}; + FILE *file = fopen(path, "r"); + + char *sptr = NULL; + while (fgets(str, sizeof(str), file)) { + DEBUG_TRACE("inside while"); + char *key = NULL; + char *value = NULL; + key = strtok_r(str, "=", &sptr); + value = strtok_r(NULL, "=", &sptr); + DEBUG_TRACE("key is: %s and value is: %s", key, value); + if (value != NULL) { + value[strlen(value) - 1] = '\0'; + } else { + DEBUG_TRACE("value is NULL"); + continue; + } + + if (!strcmp(key, "status")) { + mp_post_notification_indicator(value); + break; + } + } + + fclose(file); +} diff --git a/src/core/mp-language-mgr.c b/src/core/mp-language-mgr.c index 95b8b25..47ef6b4 100755 --- a/src/core/mp-language-mgr.c +++ b/src/core/mp-language-mgr.c @@ -224,7 +224,7 @@ void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item *object_item, const obj_item_data *data; G_LIST_FOREACH(g_lang_mgr->obj_items, l, data) { - if (data->obj_item == object_item) { + if (data && data->obj_item == object_item) { data->text_id = text_ID; break; } diff --git a/src/core/mp-setting-ctrl.c b/src/core/mp-setting-ctrl.c index 6e472a2..0ed60d4 100755 --- a/src/core/mp-setting-ctrl.c +++ b/src/core/mp-setting-ctrl.c @@ -889,9 +889,6 @@ mp_setting_read_playing_status(char *uri, char *status) } DEBUG_TRACE("Data Path is: %s", path); char playing_status[1024] = {0}; - if (path == NULL) { - return -1; - } snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI); free(path); diff --git a/src/include/music.h b/src/include/music.h index 3faf4c7..d0abbbf 100755 --- a/src/include/music.h +++ b/src/include/music.h @@ -25,6 +25,7 @@ #include #include #include +#include #include //#include #include @@ -286,6 +287,9 @@ struct appdata Evas_Object *preload_player_view; Ecore_Idler *create_on_play_lay_idler; Ecore_Timer *play_after_transit_timer; + Ecore_File_Monitor *monitor; + + notification_h noti; Evas_Object *editfiled_new_playlist; Evas_Object *editfiled_entry; diff --git a/src/mp-main.c b/src/mp-main.c index cb6a7ca..ae931c6 100755 --- a/src/mp-main.c +++ b/src/mp-main.c @@ -41,6 +41,7 @@ /* #include */ #include #include +#include #include "mp-minicontroller.h" #include "mp-lockscreenmini.h" #include "mp-app.h" @@ -1595,6 +1596,8 @@ mp_terminate(void *data) mp_music_view_mgr_release(); #endif + notification_delete(ad->noti); + notification_free(ad->noti); return; } @@ -1818,6 +1821,20 @@ app_control(app_control_h app_control, void *data) PROFILE_OUT("mp_service"); + char *path = app_get_data_path(); + DEBUG_TRACE("Path is: %s", path); + char playing_status[1024] = {0}; + if (path == NULL) { + ERROR_TRACE("unable to get data path"); + } + snprintf(playing_status, 1024, "%s%s", path, "NowPlayingStatus"); + free(path); + + if (ad->monitor == NULL) { + ad->monitor = ecore_file_monitor_add(playing_status, mp_noti_read_ini_file, NULL); + } + + #ifdef MP_DEBUG_MODE TA_S_L(0, "RENDER_FLUSH_POST(service to render)"); evas_event_callback_add(evas_object_evas_get(ad->win_main), EVAS_CALLBACK_RENDER_FLUSH_POST, _mp_main_window_flush_pre, NULL); diff --git a/src/view/mp-player-view.c b/src/view/mp-player-view.c index d1278d5..047f4e2 100755 --- a/src/view/mp-player-view.c +++ b/src/view/mp-player-view.c @@ -2964,7 +2964,7 @@ static void _mp_player_view_add_callbacks(void *data) MP_CHECK(view); CHECK_VIEW(view); struct appdata *ad = mp_util_get_appdata(); - + MP_CHECK(ad); #ifdef MP_FEATURE_LANDSCAPE bool landscape = mp_util_is_landscape(); diff --git a/src/view/mp-set-as-view.c b/src/view/mp-set-as-view.c index 1a8da1d..a1e0cd6 100755 --- a/src/view/mp-set-as-view.c +++ b/src/view/mp-set-as-view.c @@ -65,6 +65,9 @@ static char *_mp_set_as_view_time_to_string(int time) minutes_fmt = "%d"; } char *format = g_strconcat(minutes_fmt, ":", seconds_fmt, NULL); + if (!format) { + return NULL; + } char *total_txt = g_strdup_printf(format, minutes, seconds); IF_FREE(format); return total_txt; diff --git a/src/widget/mp-edit-playlist.c b/src/widget/mp-edit-playlist.c index 9cbb460..04fb083 100755 --- a/src/widget/mp-edit-playlist.c +++ b/src/widget/mp-edit-playlist.c @@ -236,6 +236,9 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in char *name = (char *)elm_entry_entry_get(mp_playlist_data->editfiled_entry); char *szFileName = elm_entry_markup_to_utf8(name); + if (!szFileName) { + return; + } int nDstLen = 0; if (!mp_util_is_playlist_name_valid(szFileName)) { -- 2.7.4