Added Notification Indicator changes for widget 83/76183/3
authorbhutani.92 <bhutani.92@samsung.com>
Thu, 23 Jun 2016 05:51:29 +0000 (11:21 +0530)
committerAkhil Bhutani <bhutani.92@samsung.com>
Thu, 23 Jun 2016 05:47:23 +0000 (22:47 -0700)
Change-Id: Iffaf4374a16ea953be8f4eaab2a02dca38ced8da
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
music-chooser/src/mc-track-list.c
music-chooser/src/music-chooser.c
src/common/mp-util.c
src/mp-main.c

index c72617a..9cfe53e 100755 (executable)
@@ -116,10 +116,8 @@ void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e st
        startfunc;
        MP_CHECK(it_data);
        struct app_data *ad = it_data->ad;
-       int ret = 0;
+       int ret = NOTIFICATION_ERROR_NONE;
 
-       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();
 
@@ -133,22 +131,7 @@ void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e st
        }
        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 {
+       if (ad->noti) {
                ret = notification_set_image(ad->noti, img_type, icon_path);
                if (ret != NOTIFICATION_ERROR_NONE) {
                        DEBUG_TRACE("Cannot set the notification image");
index 02a1e17..954bd4a 100755 (executable)
@@ -199,6 +199,22 @@ mc_create(void *data)
        elm_theme_extension_add(NULL, edje_path);
        free(path);
 
+       if (!ad->noti) {
+               DEBUG_TRACE("notification create");
+
+               int applist = NOTIFICATION_DISPLAY_APP_INDICATOR;
+               notification_type_e noti_type = NOTIFICATION_TYPE_NOTI;
+               int ret = NOTIFICATION_ERROR_NONE;
+
+               notification_delete_all(NOTIFICATION_TYPE_NOTI);
+               ad->noti = notification_create(noti_type);
+               ret = notification_set_display_applist(ad->noti, applist);
+               if (ret != NOTIFICATION_ERROR_NONE) {
+                       DEBUG_TRACE("Cannot set the display applist");
+                       notification_free(ad->noti);
+               }
+               notification_post(ad->noti);
+       }
 
        DEBUG_TRACE("end");
 
@@ -243,6 +259,7 @@ mc_app_control(app_control_h app_control, void* data)
                ad->navi_bar = _mc_create_navigation_layout(ad->base_layout);
                elm_object_part_content_set(ad->base_layout, "elm.swallow.content", ad->navi_bar);
        }
+
        if (ad->select_type >= MC_SHORTCUT_ALBUM) {
                mc_select_view_create(ad);
        } else {
index a68ffa3..d615396 100755 (executable)
@@ -2641,14 +2641,17 @@ void mp_post_notification_indicator(char *status)
        startfunc;
 
        struct appdata *ad = mp_util_get_appdata();
-       int ret = 0;
+       int ret = NOTIFICATION_ERROR_NONE;
 
        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();
+       if (!path) {
+               ERROR_TRACE("Shared Resource Path is NULL");
+               return;
+       }
 
-       //DEBUG_TRACE("Shared Resource Path is %s", path);
        char icon_path[1024] = {0};
 
        if (!strcmp(status, "playing")) {
@@ -2658,26 +2661,7 @@ void mp_post_notification_indicator(char *status)
        }
        free(path);
 
-       if(!ad->noti) {
-               DEBUG_TRACE("notification create");
-               notification_delete_all(NOTIFICATION_TYPE_NOTI);
-               ad->noti = notification_create(noti_type);
-               ret = notification_set_property(ad->noti, NOTIFICATION_PROP_VOLATILE_DISPLAY);
-               if (ret != NOTIFICATION_ERROR_NONE) {
-                       DEBUG_TRACE("Cannot set the notification property");
-               }
-               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 {
+       if (ad->noti) {
                ret = notification_set_image(ad->noti, img_type, icon_path);
                if (ret != NOTIFICATION_ERROR_NONE) {
                        DEBUG_TRACE("Cannot set the notification image");
index 123a2b8..3ebb288 100755 (executable)
@@ -35,6 +35,7 @@
 #include <signal.h>
 #include <glib.h>
 #include <glib-object.h>
+#include <notification.h>
 #include "mp-player-mgr.h"
 #include "mp-player-debug.h"
 /* TEMP_BLOCK */
@@ -1384,7 +1385,7 @@ mp_create(void *data)
        PROFILE_IN("elm_theme_extension_add");
        /* do extension add before add elm object.*/
        char edje_path[1024] ={0};
-       char * path = app_get_resource_path();
+       char *path = app_get_resource_path();
        if (path == NULL) {
                return false;
        }
@@ -1450,6 +1451,56 @@ mp_create(void *data)
        conformant = elm_conformant_add(ad->win_main);
        MP_CHECK_FALSE(conformant);
 
+#ifndef SOUND_PLAYER
+       if (!ad->noti) {
+               DEBUG_TRACE("notification create");
+
+               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;
+               int ret = NOTIFICATION_ERROR_NONE;
+
+               char *shared_path = app_get_shared_resource_path();
+               if (!shared_path) {
+                       ERROR_TRACE("Shared Resource Path is NULL");
+               }
+
+               char icon_path[1024] = {0};
+               snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_pause.png", shared_path);
+               free(shared_path);
+
+               notification_delete_all(NOTIFICATION_TYPE_NOTI);
+               ad->noti = notification_create(noti_type);
+               ret = notification_set_property(ad->noti, NOTIFICATION_PROP_VOLATILE_DISPLAY);
+               if (ret != NOTIFICATION_ERROR_NONE) {
+                       DEBUG_TRACE("Cannot set the notification property");
+               }
+               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);
+               }
+               notification_post(ad->noti);
+
+               char *data_path = app_get_data_path();
+               DEBUG_TRACE("Path is: %s", data_path);
+               char playing_status[1024] = {0};
+               if (data_path == NULL) {
+                       ERROR_TRACE("unable to get data path");
+               }
+               snprintf(playing_status, 1024, "%s%s", data_path, "NowPlayingStatus");
+               free(data_path);
+
+               if (ad->monitor == NULL) {
+                       ad->monitor = ecore_file_monitor_add(playing_status, mp_noti_read_ini_file, NULL);
+               }
+       }
+#endif
+
        elm_object_signal_emit(conformant, "elm,state,indicator,overlap", "");
        evas_object_data_set(conformant, "overlap", (void *)EINA_TRUE);
 
@@ -1830,22 +1881,6 @@ app_control(app_control_h app_control, void *data)
        }
        PROFILE_OUT("mp_service");
 
-#ifndef SOUND_PLAYER
-       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);
-       }
-#endif
-
-
 #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);