Fixed TSAM-8548 : Display wrong contact image on notification popup and notification... 34/91534/1
authorjin0.kim <jin0.kim@samsung.com>
Mon, 10 Oct 2016 05:56:50 +0000 (14:26 +0830)
committerjin0.kim <jin0.kim@samsung.com>
Mon, 10 Oct 2016 05:57:29 +0000 (14:27 +0830)
Change-Id: Ia01a43fad74220d7a963e7343d04f9c29adc4445

res/edje/quickpanel_activenoti.edc
src/notifications/activenoti.c

index af4e638..37eab30 100755 (executable)
@@ -268,7 +268,7 @@ collections
                        }
 
                        part {
-                               name: "icon_big";
+                               name: "icon_thumbnail";
                                type: SWALLOW;
                                clip_to : "masking";
                                scale: 1;
@@ -287,6 +287,37 @@ collections
                                                to: "icon_space";
                                        }
                                }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible:0;
+                               }
+                       }
+
+                       part {
+                               name: "icon_big";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       align: 0.5 0.5;
+                                       min : BOX_ICON_SIZE_W BOX_ICON_SIZE_H;
+                                       max : BOX_ICON_BG_SIZE_W BOX_ICON_BG_SIZE_W;
+                                       fixed : 1 1;
+                                       rel1 {
+                                               relative: 0.5 0.5;
+                                               to: "icon_space";
+                                       }
+                                       rel2 {
+                                               relative: 0.5 0.5;
+                                               to: "icon_space";
+                                       }
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible:0;
+                               }
                        }
 
                        part {
@@ -525,6 +556,38 @@ collections
                                action: STATE_SET "btn_show" 0.0;
                                target: "button.swallow";
                        }
+
+                       program {
+                               name: "thumbnail_show";
+                               signal: "thumbnail_show";
+                               source: "icon_thumbnail";
+                               action: STATE_SET "default" 0.0;
+                               target: "icon_thumbnail";
+                       }
+
+                       program {
+                               name: "thumbnail_hide";
+                               signal: "thumbnail_hide";
+                               source: "icon_thumbnail";
+                               action: STATE_SET "hide" 0.0;
+                               target: "icon_thumbnail";
+                       }
+
+                       program {
+                               name: "icon_show";
+                               signal: "icon_show";
+                               source: "icon_big";
+                               action: STATE_SET "default" 0.0;
+                               target: "icon_big";
+                       }
+
+                       program {
+                               name: "icon_hide";
+                               signal: "icon_hide";
+                               source: "icon_big";
+                               action: STATE_SET "hide" 0.0;
+                               target: "icon_big";
+                       }
                }
        }
 
index 1c558f7..7d276a1 100755 (executable)
@@ -655,7 +655,7 @@ static notification_h _activenoti_get_in_list(notification_h cur_noti)
        return noti;
 }
 
-static Evas_Object *_activenoti_create_icon(Evas_Object *parent, notification_h noti)
+static Evas_Object* _activenoti_create_icon(Evas_Object *parent, notification_h noti, int *image_type)
 {
        DBG("");
        retif(noti == NULL || parent == NULL , NULL, "Invalid parameter!");
@@ -669,6 +669,7 @@ static Evas_Object *_activenoti_create_icon(Evas_Object *parent, notification_h
        app_control_h app_control;
 
        retif(noti == NULL || parent == NULL, NULL, "Invalid parameter!");
+       *image_type = 0;
 
        ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &tmp);
        if (ret == NOTIFICATION_ERROR_NONE && tmp != NULL) {
@@ -688,6 +689,7 @@ static Evas_Object *_activenoti_create_icon(Evas_Object *parent, notification_h
                tmp = NULL;
                ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, &tmp);
                if (ret == NOTIFICATION_ERROR_NONE && tmp != NULL) {
+                       *image_type = 1;
                        icon_path = strdup(tmp);
                        if (!icon_path) {
                                ERR("strdup: %s", tmp);
@@ -1133,6 +1135,7 @@ static void _activenoti_update_activenoti(void)
        int btn_cnt = 0;
        bool auto_remove = true;
        bool current_auto_remove = true;
+       int image_type = 0;
 
        if (s_info.activenoti == NULL) {
                ERR("Active notification doesn't exist");
@@ -1231,9 +1234,25 @@ static void _activenoti_update_activenoti(void)
                icon = NULL;
        }
 
-       icon = _activenoti_create_icon(s_info.layout, s_info.current_noti);
+       icon = elm_object_part_content_unset(s_info.layout, "icon_thumbnail");
+       DBG("icon %p", icon);
+       if (icon != NULL) {
+               evas_object_del(icon);
+               icon = NULL;
+       }
+
+       icon = _activenoti_create_icon(s_info.layout, s_info.current_noti, &image_type);
        if (icon != NULL) {
-               elm_object_part_content_set(s_info.layout, "icon_big", icon);
+               if (image_type == 0) {
+                       elm_object_part_content_set(s_info.layout, "icon_big", icon);
+                       elm_object_signal_emit(s_info.layout, "thumbnail_hide", "icon_thumbnail");
+                       elm_object_signal_emit(s_info.layout, "icon_show", "icon_big");
+               } else {
+                       elm_image_fill_outside_set(icon, EINA_TRUE);
+                       elm_object_part_content_set(s_info.layout, "icon_thumbnail", icon);
+                       elm_object_signal_emit(s_info.layout, "icon_hide", "icon_big");
+                       elm_object_signal_emit(s_info.layout, "thumbnail_show", "icon_thumbnail");
+               }
 
                badge = elm_object_part_content_unset(s_info.layout, "icon_badge");
                DBG("badget %p", badge);