TizenRefApp-6763 Display Edit\Resend buttons for Failed to send and Draft messages 26/82526/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 3 Aug 2016 16:34:33 +0000 (19:34 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 3 Aug 2016 16:34:33 +0000 (19:34 +0300)
Change-Id: Ife5153f5090ad136803fae560f476d9789c71421
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
edje/images/messages_icon_bg.png [new file with mode: 0644]
edje/images/messages_icon_draft.png [new file with mode: 0644]
edje/images/messages_icon_failed.png [new file with mode: 0644]
inc/Resource.h
res/edje/button_theme.edc
res/edje/icons.edc [new file with mode: 0755]
src/Conversation/ConvList/View/src/ConvListViewItem.cpp

diff --git a/edje/images/messages_icon_bg.png b/edje/images/messages_icon_bg.png
new file mode 100644 (file)
index 0000000..89fa34c
Binary files /dev/null and b/edje/images/messages_icon_bg.png differ
diff --git a/edje/images/messages_icon_draft.png b/edje/images/messages_icon_draft.png
new file mode 100644 (file)
index 0000000..f870128
Binary files /dev/null and b/edje/images/messages_icon_draft.png differ
diff --git a/edje/images/messages_icon_failed.png b/edje/images/messages_icon_failed.png
new file mode 100644 (file)
index 0000000..71f8240
Binary files /dev/null and b/edje/images/messages_icon_failed.png differ
index db6efb0..77ea49e 100644 (file)
@@ -33,6 +33,7 @@
 #define ATTACH_UNKNOWN_ICON             "U01_icon_etc.png"
 
 // Edj:
+#define ICONS_EDJ_PATH                   EDJ_PATH"/icons.edj"
 #define IMAGES_EDJ_PATH                  EDJ_PATH"/images.edj"
 #define BUTTON_THEME_EDJ_PATH            EDJ_PATH"/button_theme.edj"
 #define THREAD_THEME_EDJ_PATH            EDJ_PATH"/thread_genlist_theme.edj"
index 9062ada..6e2e806 100755 (executable)
@@ -940,262 +940,6 @@ group {
        }
 }
 
-//////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////
-// button for bubble warning / scheduled message /
-/////////////////////////////////////////////////////////////////
-#define MSG_BUBBLE_BUTTON_STYLE(style_name, bg_image, press_image, dim_image, btn_image) \
-group { \
-       name: "elm/button/base/"style_name; \
-       data.item: "focus_highlight" "on"; \
-       images { \
-               image: bg_image COMP; \
-               image: press_image COMP; \
-               image: dim_image COMP; \
-               image: btn_image COMP; \
-       } \
-       parts { \
-               part { \
-                       name: "button_image"; \
-                       scale: 1; \
-                       description { \
-                               state: "default" 0.0; \
-                               min: BUTTON_BG_WIDTH BUTTON_BG_HEIGHT; \
-                               max: BUTTON_BG_WIDTH BUTTON_BG_HEIGHT; \
-                               image.normal: bg_image; \
-                       } \
-                       description { \
-                               state: "clicked" 0.0; \
-                               inherit: "default" 0.0; \
-                               image.normal: press_image; \
-                       } \
-                       description { \
-                               state: "disabled" 0.0; \
-                               inherit: "default" 0.0; \
-                               image.normal: dim_image; \
-                       } \
-               } \
-               part { \
-                       name: "left_top_padding"; \
-                       scale: 1; \
-                       type: SPACER; \
-                       description { \
-                               state: "default" 0.0; \
-                               min: 6 6; \
-                               max: 6 6; \
-                               fixed: 1 1; \
-                               align: 0.0 0.0; \
-                               rel1.to: "button_image"; \
-                               rel2.to: "button_image"; \
-                       } \
-               } \
-               part {  \
-                       name: "right_bottom_padding";  \
-                       scale: 1; \
-                       type: SPACER; \
-                       description { \
-                               state: "default" 0.0; \
-                               min: 5 5; \
-                               max: 7 7; \
-                               fixed: 1 1; \
-                               align: 1.0 1.0; \
-                               rel1.to: "button_image"; \
-                               rel1.relative: 1.0 1.0; \
-                               rel2.to: "button_image"; \
-                       } \
-               }  \
-               part {  \
-                       name: "button_center_part";  \
-                       scale: 1; \
-                       description { \
-                               state: "default" 0.0; \
-                               min: 30 30; \
-                               max: 30 30; \
-                               image.normal: btn_image; \
-                               align: 0.5 0.5; \
-                       } \
-               }  \
-               part {  \
-                       name: "elm.swallow.icon.shadow.proxy";  \
-                       type: PROXY; \
-                       clip_to: "elm.icon.proxy.clipper"; \
-                       scale: 1; \
-                       description { \
-                               state: "default" 0.0; \
-                               source: "button_center_part"; \
-                               proxy.source_clip: 0; \
-                               rel1 { to: "button_center_part"; } \
-                               rel2 { to: "button_center_part"; } \
-                       } \
-                       description { \
-                               state: "clicked" 0.0; \
-                               inherit: "default" 0.0; \
-                               rel1 { to: "button_center_part";  } \
-                               rel2 { to: "button_center_part"; } \
-                       } \
-                       description { \
-                               state: "disabled" 0.0; \
-                               inherit: "default" 0.0; \
-                       } \
-               }  \
-               part {  \
-                       name: "elm.swallow.icon.proxy";  \
-                       type: PROXY; \
-                       scale: 1; \
-                       clip_to: "icon_clipper"; \
-                       description { \
-                               state: "default" 0.0; \
-                               source: "button_center_part"; \
-                               proxy.source_clip: 0; \
-                               rel1.to: "button_center_part"; \
-                               rel2.to: "button_center_part"; \
-                       } \
-               }  \
-               part {  \
-                       name: "elm.icon.proxy.clipper";  \
-                       type: RECT; \
-                       description { \
-                               state: "default" 0.0; \
-                               color: 0 0 0 255; \
-                       } \
-                       description { \
-                               state: "clicked" 0.0; \
-                               color: 0 0 0 255; \
-                       } \
-                       description { \
-                               state: "disabled" 0.0; \
-                               color: 34 44 72 255; \
-                       } \
-               } \
-               part {  \
-                       name: "icon_clipper"; \
-                       type: RECT; \
-                       scale: 1; \
-                       description { \
-                               state: "default" 0.0; \
-                               color: 250 250 250 255; \
-                       } \
-                       description { \
-                               state: "clicked" 0.0; \
-                               color: 250 250 250 255; \
-                       } \
-                       description { \
-                               state: "disabled" 0.0; \
-                               color: 166 167 169 255; \
-                       } \
-               }  \
-               part {  \
-                       name: "over1";  \
-                       type: RECT; \
-                       ignore_flags: ON_HOLD; \
-                       description { \
-                               state: "default" 0.0; \
-                               color: 0 0 0 0; \
-                               min: 30 30; \
-                       } \
-               } \
-               part {  \
-                       name: "over2";  \
-                       type: RECT; \
-                       repeat_events: 1; \
-                       description { \
-                               state: "default" 0.0; \
-                               color: 0 0 0 0; \
-                       } \
-               }  \
-               part {  \
-                       name: "disabler";  \
-                       type: RECT; \
-                       description { \
-                               state: "default" 0.0; \
-                               color: 0 0 0 0; \
-                               visible: 0; \
-                       } \
-                       description { \
-                               state: "disabled" 0.0; \
-                               inherit: "default" 0.0; \
-                               visible: 1; \
-                       } \
-               }  \
-       }  \
-       programs { \
-               program { \
-                       name: "button_click"; \
-                       signal: "mouse,down,1"; \
-                       source: "over1"; \
-                       action: SIGNAL_EMIT "elm,action,press" ""; \
-                       after: "button_click_anim"; \
-               } \
-               program { \
-                       name: "button_click_anim"; \
-                       action: STATE_SET "clicked" 0.0; \
-                       target: "button_image"; \
-                       target: "elm.swallow.icon.shadow.proxy"; \
-                       target: "elm.icon.proxy.clipper"; \
-                       target: "icon_clipper"; \
-               } \
-               program { \
-                       name: "button_double_click"; \
-                       signal: "mouse,down,1,double"; \
-                       source: "over1"; \
-                       after: "button_click_anim"; \
-               } \
-               program { \
-                       name: "button_unclick"; \
-                       signal: "mouse,up,1"; \
-                       source: "over2"; \
-                       action: SIGNAL_EMIT "elm,action,unpress" ""; \
-                       after: "button_unclick_anim"; \
-               } \
-               program { \
-                       name: "button_unclick_anim"; \
-                       action: STATE_SET "default" 0.0; \
-                       target: "button_image"; \
-                       target: "elm.swallow.icon.shadow.proxy"; \
-                       target: "elm.icon.proxy.clipper"; \
-                       target: "icon_clipper"; \
-               } \
-               program { \
-                       name: "touch_snd"; \
-                       signal: "mouse,clicked,1"; \
-                       source: "over1"; \
-                       action: RUN_PLUGIN "touch_sound"; \
-                       after: "button_unclick3"; \
-               } \
-               program { \
-                       name: "button_unclick3"; \
-                       action: SIGNAL_EMIT "elm,action,click" ""; \
-               } \
-               program { \
-                       name: "disable"; \
-                       signal: "elm,state,disabled"; \
-                       source: "elm"; \
-                       action: STATE_SET "disabled" 0.0; \
-                       target: "disabler"; \
-                       target: "button_image"; \
-                       target: "elm.swallow.icon.shadow.proxy"; \
-                       target: "elm.icon.proxy.clipper"; \
-                       target: "icon_clipper"; \
-               } \
-               program { \
-                       name: "enable"; \
-                       signal: "elm,state,enabled"; \
-                       source: "elm"; \
-                       action: STATE_SET "default" 0.0; \
-                       target: "disabler"; \
-                       target: "button_image"; \
-                       target: "elm.swallow.icon.shadow.proxy"; \
-                       target: "elm.icon.proxy.clipper"; \
-                       target: "icon_clipper"; \
-               } \
-       } \
-}
-
-MSG_BUBBLE_BUTTON_STYLE("resend_button", "M01_circle_button_delete.png", "M01_circle_button_delete_press.png", "M01_circle_button_delete_dim.png", "M01_btn_warning.png")
-MSG_BUBBLE_BUTTON_STYLE("scheduled_button", "M01_circle_button.png", "M01_circle_button_press.png", "M01_circle_button_dim.png", "M01_btn_schedule.png")
-MSG_BUBBLE_BUTTON_STYLE("edit_button", "M01_circle_button_press.png", "M01_circle_button.png", "M01_circle_button_dim.png", "badge_icon_draft_pencil.png")
-
 #define MSG_BUTTON_CIRCLE_STYLE(style_name, image_normal, image_effect, image_dim_effect, min_width, min_height) \
    group { name: "elm/button/base/"style_name; \
       data { \
diff --git a/res/edje/icons.edc b/res/edje/icons.edc
new file mode 100755 (executable)
index 0000000..3239bd8
--- /dev/null
@@ -0,0 +1,106 @@
+#include "macros.inl"
+
+collections {
+    BASE_SCALE;
+    images {
+        image: "messages_icon_bg.png" RAW;
+    }
+    group {
+        name: "draft_icon";
+        images {
+            image: "messages_icon_draft.png" RAW;
+        }
+        parts {
+            part {
+                name: "bg";
+                type: IMAGE;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    image.normal: "messages_icon_bg.png";
+                    color: 90 111 199 255;
+                }
+                description {
+                    state: "pressed" 0.0;
+                    inherit: "default";
+                    color: 70 80 170 255;
+                }
+            }
+            part {
+                name: "draft";
+                type: IMAGE;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    image.normal: "messages_icon_draft.png";
+                    color: 250 250 250 255;
+                }
+            }
+        }
+        programs {
+           program { name: "pressed";
+               source: "*";
+               signal: "pressed";
+               action: STATE_SET "pressed" 0.0;
+               target: "bg";
+               transition: LINEAR  0.1;
+           }
+           program { name: "unpressed";
+               source: "*";
+               signal: "unpressed";
+               action: STATE_SET "default" 0.0;
+               target: "bg";
+               transition: LINEAR  0.1;
+           }
+       }
+    }
+    group {
+        name: "failed_icon";
+        images {
+            image: "messages_icon_failed.png" RAW;
+        }
+        parts {
+            part {
+                name: "bg";
+                type: IMAGE;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    image.normal: "messages_icon_bg.png";
+                    color: 224 34 34 255;
+                }
+                description {
+                    state: "pressed" 0.0;
+                    inherit: "default";
+                    color: 204 14 14 255;
+                }
+            }
+            part {
+                name: "failed";
+                type: IMAGE;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    image.normal: "messages_icon_failed.png";
+                    color: 250 250 250 255;
+                }
+            }
+        }
+        programs {
+           program { name: "pressed";
+               source: "*";
+               signal: "pressed";
+               action: STATE_SET "pressed" 0.0;
+               target: "bg";
+               transition: LINEAR  0.1;
+           }
+           program { name: "unpressed";
+               source: "*";
+               signal: "unpressed";
+               action: STATE_SET "default" 0.0;
+               target: "bg";
+               transition: LINEAR  0.1;
+           }
+       }
+    }
+}
index bb5a043..6e26bea 100644 (file)
@@ -18,6 +18,7 @@
 #include "ConvListViewItem.h"
 #include "CallbackAssist.h"
 #include "ListView.h"
+#include "Resource.h"
 
 using namespace Msg;
 
@@ -37,9 +38,6 @@ namespace
     const char *failedButtonPart = "failed.button";
     const char *infoStatus = "info.status";
     const char *msgType = "msg.type";
-
-    const char *draftButtonStyle = "edit_button";
-    const char *failedButtonStyle = "resend_button";
 }
 
 ConvListViewItem::ConvListViewItem(ConvItemType type)
@@ -96,27 +94,49 @@ const char *ConvListViewItem::getCheckPart(ListItem &item)
 
 Evas_Object *ConvListViewItem::createButton(bool isEnabled, ConvItemType type)
 {
-    Evas_Object *button = nullptr;
-    if(type == Draft || type == Failed)
-    {
-        button = elm_button_add(*getOwner());
-        if(type == Draft)
+    Evas_Object *button = elm_button_add(*getOwner());
+    evas_object_event_callback_add
+    (
+        button,
+        EVAS_CALLBACK_MOUSE_DOWN,
+        [](void *data, Evas *e, Evas_Object *obj, void *event_info)
         {
-            elm_object_style_set(button, draftButtonStyle);
-            evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this);
-        }
-        else if(type == Failed)
+            if(!elm_object_disabled_get(obj))
+                elm_object_signal_emit(elm_object_content_get(obj), "pressed", "*");
+        },
+        this
+    );
+    evas_object_event_callback_add
+    (
+        button,
+        EVAS_CALLBACK_MOUSE_UP,
+        [](void *data, Evas *e, Evas_Object *obj, void *event_info)
         {
-            elm_object_style_set(button, failedButtonStyle);
-            evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onFailedButtonClicked), this);
-        }
-        View::expand(button);
-        evas_object_show(button);
+            if(!elm_object_disabled_get(obj))
+                elm_object_signal_emit(elm_object_content_get(obj), "unpressed", "*");
+        },
+        this
+    );
 
-        evas_object_propagate_events_set(button, !isEnabled);
-        elm_object_disabled_set(button, !isEnabled);
+    elm_object_style_set(button, "transparent");
+    Evas_Object *icon =  nullptr;
+    evas_object_show(icon);
 
+    if(type == Draft)
+    {
+        icon = View::addLayout(button, ICONS_EDJ_PATH, "draft_icon");
+        evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this);
     }
+    else if(type == Failed)
+    {
+        icon = View::addLayout(button, ICONS_EDJ_PATH, "failed_icon");
+        evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onFailedButtonClicked), this);
+    }
+
+    elm_object_content_set(button, icon);
+    evas_object_propagate_events_set(button, !isEnabled);
+    elm_object_disabled_set(button, !isEnabled);
+
     return button;
 }