TizenRefApp-5091 Implement draft message style 76/57976/1
authorDmytro Dragan <dm.dragan@samsung.com>
Tue, 26 Jan 2016 12:59:32 +0000 (14:59 +0200)
committerDmytro Dragan <dm.dragan@samsung.com>
Tue, 26 Jan 2016 13:00:00 +0000 (15:00 +0200)
Change-Id: I0be63384c0d89044badadb97225cb0fc847e63f3
Signed-off-by: Dmytro Dragan <dm.dragan@samsung.com>
edje/images/messages_bubble_line_draft.#.png [new file with mode: 0644]
res/edje/bubble_theme.edc
res/edje/button_theme.edc
src/Conversation/ConvList/Controller/inc/ConvListItem.h
src/Conversation/ConvList/Controller/src/ConvListItem.cpp
src/Conversation/ConvList/View/inc/ConvListViewItem.h
src/Conversation/ConvList/View/src/ConvListViewItem.cpp

diff --git a/edje/images/messages_bubble_line_draft.#.png b/edje/images/messages_bubble_line_draft.#.png
new file mode 100644 (file)
index 0000000..38379be
Binary files /dev/null and b/edje/images/messages_bubble_line_draft.#.png differ
index 376f6ea..e3262dc 100755 (executable)
@@ -83,6 +83,7 @@ images {
        image: "badge_bg_draft.png" COMP;
        image: "messages_bubble_bg.#.png" COMP;
        image: "messages_bubble_bg_ef.#.png" COMP;
+       image: "messages_bubble_line_draft.#.png" COMP;
 }
 
 group {
@@ -1872,9 +1873,16 @@ BUBBLE_SENT_MESSAGE_STYLE("sent_style_01_failed_focus", "messagebubble_bg_send_b
 #define BUBBLE_INFO_STATUS_WIDTH 30
 #define BUBBLE_INFO_STATUS_PAD_WIDTH 4
 #define BUBBLE_INFO_TEXT_HEIGHT 38
+#define BUBBLE_DRAFT_PAD_WIDTH 94
+#define BUBBLE_DRAFT_BUTTON_PAD_WIDTH 26
+#define BUBBLE_DRAFT_BUTTON_PAD_HEIGHT 7
+#define BUBBLE_DRAFT_BUTTON_WIDTH 56
+#define BUBBLE_DRAFT_BUTTON_HEIGHT 56
 
 #define BUBBLE_BG_COLOR 90 111 199 230
 #define BUBBLE_BG_COLOR_PRESSED 78 97 173 230
+#define BUBBLE_BG_DRAFT_COLOR 106 126 204 255
+#define BUBBLE_BG_DRAFT_COLOR_PRESSED 80 94 153 255
 
 group { name: "elm/genlist/item/sentbubble/default";
     alias: "elm/genlist/item_compress/sentbubble/default";
@@ -1883,12 +1891,11 @@ group { name: "elm/genlist/item/sentbubble/default";
     data.item: "texts" "info.time";
     data.item: "contents" "bubble.content info.thumbnail info.status info.status1 bubble.check";
     parts{
-        rect { "base"; scale;
+        spacer { "base"; scale; mouse;
             desc { "default";
                 rel1.to_y: "info.pad";
                 rel2.to_y: "pad.bottom";
                 align: 0.0 0.0;
-                color: 0 0 0 0;
             }
         }
         swallow { "elm.swallow.bg"; scale;
@@ -2143,7 +2150,54 @@ group { name: "elm/genlist/item/sentbubble/default";
 group { name: "elm/genlist/item/draft/default";
     alias: "elm/genlist/item_compress/draft/default";
     inherit: "elm/genlist/item/sentbubble/default";
-    //TODO: implement in next commit
+
+    data.item: "contents" "bubble.content info.thumbnail info.status info.status1 bubble.check draft.button";
+
+    parts {
+        image { "bubble.bg.image"; scale;
+            desc { "default";
+                image.normal: "messages_bubble_line_draft.#.png";
+                color: BUBBLE_BG_DRAFT_COLOR;
+            }
+            desc { "pressed";
+                color: BUBBLE_BG_DRAFT_COLOR_PRESSED;
+            }
+        }
+        spacer { "bubble.pad.right"; scale;
+            desc { "default";
+                rel2.to_x: "draft.pad";
+            }
+        }
+        spacer { "draft.pad"; scale;
+            desc { "default";
+                min: BUBBLE_DRAFT_PAD_WIDTH 0;
+                max: BUBBLE_DRAFT_PAD_WIDTH -1;
+                rel2.to_x: "pad.right";
+                rel2.relative: 0.0 0.0;
+                align: 1.0 0.0;
+                fixed: 1 0;
+            }
+        }
+        spacer { "draft.pad.button"; scale;
+            desc { "default";
+                min: BUBBLE_DRAFT_BUTTON_PAD_WIDTH BUBBLE_DRAFT_BUTTON_PAD_HEIGHT;
+                max: BUBBLE_DRAFT_BUTTON_PAD_WIDTH BUBBLE_DRAFT_BUTTON_PAD_HEIGHT;
+                rel1.to_x: "draft.pad";
+                rel1.to_y: "bubble.pad.top";
+                fixed: 1 1;
+                align: 0.0 0.0;
+            }
+        }
+        swallow { "draft.button"; scale;
+            desc { "default";
+                min: BUBBLE_DRAFT_BUTTON_WIDTH BUBBLE_DRAFT_BUTTON_HEIGHT;
+                max: BUBBLE_DRAFT_BUTTON_WIDTH BUBBLE_DRAFT_BUTTON_HEIGHT;
+                rel1.to: "draft.pad.button";
+                rel1.relative: 1.0 1.0;
+                align: 0.0 0.0;
+            }
+        }
+    }
 }
 
 group { name: "elm/genlist/item/receivebubble/default";
index ada48b1..5b5545e 100755 (executable)
@@ -12,6 +12,8 @@
 #define BUTTON_TEXT_STYLE1_VISIBLE_ICON_MIN_MAX_INC 28 28
 #define BUTTON_TEXT_STYLE1_ICONONLY_ICON_MIN_MAX_INC 28 28
 #define BUTTON_BG_BORDER_INC 8 8 8 8
+#define BUTTON_BG_WIDTH 56
+#define BUTTON_BG_HEIGHT 56
 
 //text
 #define BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC 249 249 249 255
@@ -953,8 +955,8 @@ group { \
                        scale: 1; \
                        description { \
                                state: "default" 0.0; \
-                               min: 40 40; \
-                               max: 40 40; \
+                               min: BUTTON_BG_WIDTH BUTTON_BG_HEIGHT; \
+                               max: BUTTON_BG_WIDTH BUTTON_BG_HEIGHT; \
                                image.normal: bg_image; \
                        } \
                        description { \
@@ -1186,7 +1188,7 @@ group { \
 
 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_press.png", "M01_circle_button_press.png", "badge_icon_draft_pencil.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; \
index d3a1f15..3b4799e 100644 (file)
@@ -52,6 +52,8 @@ namespace Msg
             virtual std::string getText();
             virtual std::string getTime();
 
+            virtual void onEditButtonClicked(Evas_Object *obj, void *event_info);
+
         private:
             ConvListViewItem::ConvItemType getConvItemType(MsgConversationItem &item);
 
index 1135f31..e984a9b 100644 (file)
@@ -216,3 +216,8 @@ void ConvListItem::onViewDetailsItemPressed(ContextPopupItem &item)
     MSG_LOG("");
 }
 
+void ConvListItem::onEditButtonClicked(Evas_Object *obj, void *event_info)
+{
+    MSG_LOG("");
+}
+
index 63b3258..f83e081 100644 (file)
@@ -42,7 +42,10 @@ namespace Msg
             virtual std::string getText() = 0;
             virtual std::string getTime() = 0;
 
+            virtual void onEditButtonClicked(Evas_Object *obj, void *event_info) = 0;
+
         private:
+            Evas_Object *getDraftButton(bool isEnabled);
             virtual std::string getText(ListItem &item, const char *part);
             virtual Evas_Object *getContent(ListItem &item, const char *part);
             virtual const char *getCheckPart(ListItem &item);
index ecc18a1..ab714bc 100644 (file)
@@ -16,6 +16,8 @@
  */
 
 #include "ConvListViewItem.h"
+#include "CallbackAssist.h"
+#include "ListView.h"
 
 using namespace Msg;
 
@@ -30,6 +32,9 @@ namespace
     const char *bubbleContentPart = "bubble.content";
     const char *thumbContentPart = "info.thumbnail";
     const char *timeTextPart = "info.time";
+    const char *draftButtonPart = "draft.button";
+
+    const char *draftButtonStyle = "edit_button";
 }
 
 ConvListViewItem::ConvListViewItem(ConvItemType type)
@@ -72,6 +77,8 @@ Evas_Object *ConvListViewItem::getContent(ListItem &item, const char *part)
         return getBubble();
     else if(!strcmp(part, thumbContentPart))
         return getThumbnail();
+    else if(!strcmp(part, draftButtonPart))
+        return getDraftButton(!getOwner()->getCheckMode());
     else
         return nullptr;
 }
@@ -80,3 +87,24 @@ const char *ConvListViewItem::getCheckPart(ListItem &item)
 {
     return checkBoxPart;
 }
+
+Evas_Object *ConvListViewItem::getDraftButton(bool isEnabled)
+{
+    Evas_Object *button = elm_button_add(*getOwner());
+    elm_object_style_set(button, draftButtonStyle);
+    evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    evas_object_show(button);
+
+    if(isEnabled)
+    {
+        evas_object_propagate_events_set(button, EINA_FALSE);
+        evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this);
+    }
+    else
+    {
+        elm_object_disabled_set(button, EINA_TRUE);
+    }
+
+    return button;
+}