TizenRefApp-6234 Move character count above the send-button 55/72855/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 2 Jun 2016 16:04:04 +0000 (19:04 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 2 Jun 2016 16:31:20 +0000 (19:31 +0300)
Change-Id: I5476689dbb26a4d7564deb6574db8a9ebe667f0a
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
edje/images/btn_conversation_add.png [changed mode: 0755->0644]
res/edje/macros.inl
res/edje/msg_input_panel.edc
res/edje/msg_thread.edc
src/Common/Utils/inc/TextDecorator.h
src/Common/Utils/src/TextDecorator.cpp
src/Conversation/Main/View/inc/MessageInputPanel.h
src/Conversation/Main/View/src/MessageInputPanel.cpp

old mode 100755 (executable)
new mode 100644 (file)
index 65c56e8..ef87e7b
Binary files a/edje/images/btn_conversation_add.png and b/edje/images/btn_conversation_add.png differ
index 37bd3fa..17a97a4 100644 (file)
@@ -1,4 +1,4 @@
-#define BASE_SCALE 1.8
+#define BASE_SCALE base_scale: 2.6;
 
 #define PADDING_LEFT(param_padding_name, param_padding_size) \
        part \
index 48f4b5d..5ed16f4 100644 (file)
@@ -2,13 +2,14 @@
 
 #define COLOR_WHITE                            255 255 255 255
 #define COLOR_BLUE                             2 61 132 255
+#define COLOR_GRAY              128 128 128 255
 
-#define BODY_ADDBUTTON_SIZE 50 50
-#define BODY_SENDBUTTON_SIZE 46 40
+#define BODY_ADDBUTTON_SIZE 72 72
+#define BODY_SENDBUTTON_SIZE 72 43
 
 collections {
 
-    base_scale: 1.8;
+    BASE_SCALE;
 
     group {
            name: "conversation/msg_input_panel";
@@ -21,66 +22,43 @@ collections {
                            mouse_events: 0;
                            description {
                                    state: "default" 0.0;
-                                   min: 0 80;
+                                   min: 0 154;
                                    rel1{ relative: 0.0 0.0; }
                                    rel2{ relative: 1.0 1.0; }
-                                   color: COLOR_WHITE;
                            }
                    }
                    
                    PADDING_TOP("padding_top", 1);
-                   PADDING_BOTTOM("padding_btn_bottom", 18);
                    PADDING_TOP("padding_entry_top", 5);
-                   PADDING_BOTTOM("padding_entry_bottom", 18);
-                   PADDING_BOTTOM("padding_send_btn_bottom", 4);
-                   PADDING_LEFT("padding_left", 11);
-                   PADDING_RIGHT("padding_right", 15);
+                   PADDING_BOTTOM("padding_entry_bottom", 56);
+                   PADDING_BOTTOM("padding_add_btn_bottom", 44);
+                   PADDING_LEFT("padding_left", 32);
+                   PADDING_RIGHT("padding_right", 43);
 
                    part {
-                           name: "rect.add_bt_area";
-                           type: SPACER;
-                           scale: 1;
-                           description {
-                                   state: "default" 0.0;
-                                   min: BODY_ADDBUTTON_SIZE;
-                                   max: BODY_ADDBUTTON_SIZE;
-                                   fixed: 1 1;
-                                   rel1 { to_x: "padding_left"; to_y: "padding_btn_bottom"; relative: 1.0 0.0; }
-                                   rel2 { to_x: "padding_left"; to_y: "padding_btn_bottom"; relative: 1.0 0.0; }
-                                   align: 0.0 1.0;
-                           }
-                           description {
-                                   state: "landscape" 0.0;
-                                   inherit: "default" 0.0;
-                                   rel1 { to_x: "padding_left"; to_y: "padding_btn_bottom"; relative: 1.0 0.0; }
-                                   rel2 { to_x: "padding_left"; to_y: "padding_btn_bottom"; relative: 1.0 0.0; }
-                                   align: 0.0 1.0;
-                           }
-                   }
-                   part {
                            name: "swl.add_button";
                            type: SWALLOW;
                            scale: 1;
                            description {
-                                   max: BODY_ADDBUTTON_SIZE;
-                                   min: BODY_ADDBUTTON_SIZE;
-                                   state: "default" 0.0;
-                                   fixed: 1 1;
-                                   rel1 { to: "rect.add_bt_area"; relative: 0.0 0.0; }
-                                   rel2 { to: "rect.add_bt_area"; relative: 1.0 1.0; }
-                                   align: 0.5 0.5;
+                    state: "default" 0.0;
+                    min: BODY_ADDBUTTON_SIZE;
+                    max: BODY_ADDBUTTON_SIZE;
+                    fixed: 1 1;
+                    rel1 { to_x: "padding_left"; to_y: "padding_add_btn_bottom"; relative: 1.0 0.0; }
+                    rel2 { to_x: "padding_left"; to_y: "padding_add_btn_bottom"; relative: 1.0 0.0; }
+                    align: 0.0 1.0;
                            }
                    }
                    part {
-                           name: "padding1"; //padding between add button and input field..
+                           name: "padding1"; //padding between add button and input field.
                            type: SPACER;
                            scale: 1;
                            description {
                                    state: "default" 0.0;
                                    min: 10 0;
                                    fixed: 1 0;
-                                   rel1 { to_x: "rect.add_bt_area"; relative: 1.0 0.0; }
-                                   rel2 { to_x: "rect.add_bt_area"; relative: 1.0 1.0; }
+                                   rel1 { to_x: "swl.add_button"; relative: 1.0 0.0; }
+                                   rel2 { to_x: "swl.add_button"; relative: 1.0 1.0; }
                                    align: 0.0 0.0;
                            }
                    }
@@ -107,8 +85,8 @@ collections {
                                    max: -1 2;
                                    fixed: 1 1;
                                    align: 0.0 1.0;
-                                   rel1 { to: "text_count_rect"; relative: 0.0 0.0; }
-                                   rel2 { to: "text_count_rect"; relative: 1.0 0.0; }
+                                   rel1 { to: "text.char_count"; relative: 0.0 0.0; }
+                                   rel2 { to: "text.char_count"; relative: 1.0 0.0; }
                            }
                    }
                    part {
@@ -117,35 +95,22 @@ collections {
                            scale: 1;
                            mouse_events: 0;
                            description {
-                                   state: "default" 0.0;
-                                   rel1 { to: "text_count_rect"; relative: 0.0 0.0; }
-                                   rel2 { to: "text_count_rect"; relative: 1.0 1.0; }
-                                   align: 0.5 0.5;
-                                   color: COLOR_BLUE;
+                    state: "default" 0.0;
+                    min: 73 31;
+                    max: 73 31;
+                    fixed: 1 1;
+                    rel1 { to_x: "padding_right"; to_y: "swl.add_button"; relative: 0.0 0.5; }
+                    rel2 { to_x: "padding_right"; to_y: "swl.add_button"; relative: 0.0 0.5; }
+                    align: 1.0 1.0;
+                    visible: 1;
+                                   color: COLOR_GRAY;
                                    text {
-                                           size: 17;
-                                           text: "";
+                                           size: 23;
+                                           align: 1.0 0.5;
                                    }
                            }
                    }
                    part {
-                           name: "text_count_rect";
-                           type: RECT;
-                           scale: 1;
-                           mouse_events:  1;
-                           description {
-                                   state: "default" 0.0;
-                                   min: 54 20;
-                                   max: 54 20;
-                                   fixed: 1 1;
-                                   rel1 { to_x: "padding_right"; to_y: "padding_send_btn_bottom"; relative: 0.0 0.0; }
-                                   rel2 { to_x: "padding_right"; to_y: "padding_send_btn_bottom"; relative: 0.0 0.0; }
-                                   align: 1.0 1.0;
-                                   color: 0 0 0 0;
-                                   visible: 1;
-                           }
-                   }
-                   part {
                            name: "padding2"; //padding between input field of right side and send button
                            type: SPACER;
                            scale: 1;
@@ -154,28 +119,8 @@ collections {
                                    fixed: 1 0;
                                    min: 14 0;
                                    align: 1.0 0.0;
-                                   rel1 { to_x: "rect.send_button"; relative: 0.0 0.0; }
-                                   rel2 { to_x: "rect.send_button"; relative: 0.0 1.0; }
-                           }
-                   }
-                   part {
-                           name: "rect.send_button";
-                           type: SPACER;
-                           scale: 1;
-                           description {
-                                   state: "default" 0.0;
-                                   fixed: 1 1;
-                                   min: BODY_SENDBUTTON_SIZE;
-                                   max: BODY_SENDBUTTON_SIZE;
-                                   align: 1.0 1.0;
-                                   rel1 { to_x: "padding_right"; to_y: "padding_top"; relative: 0.0 1.0; }
-                                   rel2 { to_x: "padding_right"; to_y: "text_padding"; relative: 0.0 0.0; }
-                           }
-                           description {
-                                   state: "landscape" 0.0;
-                                   inherit: "default" 0.0;
-                                   rel1 { to_x: "padding_right"; to_y: "padding_top"; relative: 0.0 1.0; }
-                                   rel2 { to_x: "padding_right"; to_y: "text_padding"; relative: 0.0 0.0; }
+                                   rel1 { to_x: "swl.send_button"; relative: 0.0 0.0; }
+                                   rel2 { to_x: "swl.send_button"; relative: 0.0 1.0; }
                            }
                    }
                    part {
@@ -184,22 +129,17 @@ collections {
                            scale: 1;
                            description {
                                    state: "default" 0.0;
-                                   fixed: 1 1;
-                                   min: BODY_SENDBUTTON_SIZE;
-                                   max: BODY_SENDBUTTON_SIZE;
-                                   rel1 { to: "rect.send_button"; relative: 0.0 0.0; }
-                                   rel2 { to: "rect.send_button"; relative: 1.0 1.0; }
-                                   align: 0.5 0.5;
-                                   visible: 1;
+                    fixed: 1 1;
+                    min: BODY_SENDBUTTON_SIZE;
+                    max: BODY_SENDBUTTON_SIZE;
+                    align: 1.0 0.0;
+                    rel1 { to_x: "padding_right"; to_y: "swl.add_button"; relative: 0.0 0.5; }
+                    rel2 { to_x: "padding_right"; to_y: "swl.add_button"; relative: 0.0 0.5; }
                            }
                            description {
                                    state: "hide" 0.0;
                                    visible: 0;
                            }
-                           description {
-                                   state: "landscape" 0.0;
-                                   inherit: "default" 0.0;
-                           }
                    }
            }
            programs {
@@ -223,28 +163,6 @@ collections {
                            action: STATE_SET "default" 0.0;
                            target: "swl.send_button";
                    }
-                   program {
-                           name: "show.portrait.mode";
-                           signal: "show.portrait.mode";
-                           source: "*";
-                           action: STATE_SET "default" 0.0;
-                           target: "rect.send_button";
-                           target: "swl.send_button";
-                           target: "rect.add_bt_area";
-                           target: "swl.main";
-                           target: "text_padding";
-                   }
-                   program {
-                           name: "show.landscape.mode";
-                           signal: "show.landscape.mode";
-                           source: "*";
-                           action: STATE_SET "landscape" 0.0;
-                           target: "rect.send_button";
-                           target: "swl.send_button";
-                           target: "rect.add_bt_area";
-                           target: "swl.main";
-                           target: "text_padding";
-                   }
            }
     }
 }
index 608fe85..55cf8f8 100755 (executable)
@@ -2,7 +2,7 @@
 
 collections {
 
-    base_scale: BASE_SCALE;
+    BASE_SCALE;
 
     group { name: "msg_thread_layout";
       parts {
index aab2768..ec2a7e4 100644 (file)
@@ -33,7 +33,8 @@ namespace Msg
     class TextStyle
     {
         public:
-            static const std::string defaultColor;
+            static const char *defaultColor;
+            static const char *whiteColor;
             static const int defaultFontSize;
 
         public:
index d7c1573..e8f864f 100644 (file)
@@ -22,7 +22,8 @@
 
 using namespace Msg;
 
-const std::string TextStyle::defaultColor = "#000000FF";
+const char *TextStyle::defaultColor = "#000000FF";
+const char *TextStyle::whiteColor = "#FFFFFFFF";
 const int TextStyle::defaultFontSize = 28;
 
 #define OPEN_TAG(name, val) "<" name "=" << (val) << ">"
index f7c87d3..2209234 100644 (file)
@@ -47,10 +47,14 @@ namespace Msg
 
         private:
             void create(Evas_Object *parent);
-            Evas_Object *createButton(Evas_Object *parent, const char *iconRes, const char *style, ButtonId buttonId);
+            Evas_Object *createButton(Evas_Object *parent, ButtonId buttonId);
+            Evas_Object *createAddButton(Evas_Object *parent);
+            Evas_Object *createSendButton(Evas_Object *parent);
             Evas_Object *getIcon(Evas_Object *button);
             Evas_Object *getButton(ButtonId id);
 
+            void updateSendButtonTitle();
+
             void setNormalColor(Evas_Object *button);
             void setPressedColor(Evas_Object *button);
             void setDisabledColor(Evas_Object *button);
@@ -63,6 +67,7 @@ namespace Msg
             IMessageInputPanelListener * m_pListener;
             Evas_Object *m_pLayout;
             Evas_Object *m_pSendButton;
+            Evas_Object *m_pSendLabel;
             Evas_Object *m_pAddButton;
     };
 
index 0a3859f..368bddd 100644 (file)
 #include "PathUtils.h"
 #include "CallbackAssist.h"
 #include "Logger.h"
+#include "LangUtils.h"
+#include "TextDecorator.h"
+
+using namespace Msg;
 
 namespace
 {
     const char *buttonIdKey = "id";
+    const TextStyle sendTextStyle(32, TextStyle::whiteColor, TextAlign::Right);
 }
 
-using namespace Msg;
-
 MessageInputPanel::MessageInputPanel(Evas_Object *parent)
     : m_pListener(nullptr)
     , m_pLayout(nullptr)
     , m_pSendButton(nullptr)
+    , m_pSendLabel(nullptr)
     , m_pAddButton(nullptr)
 {
     create(parent);
@@ -50,8 +54,8 @@ void MessageInputPanel::create(Evas_Object *parent)
     std::string edjPath = PathUtils::getResourcePath(MSG_INPUT_PANEL_EDJ_PATH);
     elm_layout_file_set(m_pLayout, edjPath.c_str(), "conversation/msg_input_panel");
 
-    m_pSendButton = createButton(m_pLayout, CONV_SEND_IMG, "send_custom", SendButtonId);
-    m_pAddButton = createButton(m_pLayout, CONV_ADD_IMG, "body_button", AddButtonId);
+    m_pSendButton = createSendButton(m_pLayout);
+    m_pAddButton = createAddButton(m_pLayout);
 
     elm_object_part_content_set(m_pLayout, "swl.send_button", m_pSendButton);
     elm_object_part_content_set(m_pLayout, "swl.add_button", m_pAddButton);
@@ -64,7 +68,7 @@ void MessageInputPanel::setEntry(Evas_Object *obj)
 
 Evas_Object *MessageInputPanel::getIcon(Evas_Object *button)
 {
-    return elm_object_part_content_get(button, "button_center_part");
+    return elm_object_content_get(button);
 }
 
 void MessageInputPanel::setNormalColor(Evas_Object *button)
@@ -102,26 +106,50 @@ Evas_Object *MessageInputPanel::getButton(ButtonId id)
     return nullptr;
 }
 
-Evas_Object *MessageInputPanel::createButton(Evas_Object *parent, const char *iconRes, const char *style, ButtonId buttonId)
+Evas_Object *MessageInputPanel::createButton(Evas_Object *parent, ButtonId buttonId)
 {
     Evas_Object *button = elm_button_add(parent);
-    elm_object_style_set(button, style);
+    elm_object_style_set(button, "transparent");
     evas_object_data_set(button, buttonIdKey, (void*)buttonId);
     evas_object_size_hint_weight_set(button, 0.0, 0.0);
-    evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(MessageInputPanel, onButtonClicked), this);
+    evas_object_smart_callback_add(button, "pressed", SMART_CALLBACK(MessageInputPanel, onButtonPressed), this);
+    evas_object_smart_callback_add(button, "unpressed", SMART_CALLBACK(MessageInputPanel, onButtonUnpressed), this);
     evas_object_show(button);
+    return button;
+}
+
+void MessageInputPanel::updateSendButtonTitle()
+{
+    //TODO: on language changed cb
+    std::string text = TextDecorator::make(msg("IDS_MSG_BUTTON_SEND_ABB3"), sendTextStyle);
+    elm_object_text_set(m_pSendLabel, text.c_str());
+}
+
+Evas_Object *MessageInputPanel::createSendButton(Evas_Object *parent)
+{
+    Evas_Object *button = createButton(parent, SendButtonId);
+
+    m_pSendLabel = elm_label_add(button);
+    updateSendButtonTitle();
+    elm_object_content_set(button, m_pSendLabel);
+    evas_object_show(m_pSendLabel);
+    evas_object_color_set(m_pSendLabel, BUTTON_COLOR);
+
+    return button;
+}
+
+Evas_Object *MessageInputPanel::createAddButton(Evas_Object *parent)
+{
+    Evas_Object *button = createButton(parent, AddButtonId);
 
     Evas_Object *icon = elm_icon_add(button);
     std::string resPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH);
     evas_object_show(icon);
-    elm_image_file_set(icon, resPath.c_str(), iconRes);
+    elm_image_file_set(icon, resPath.c_str(), CONV_ADD_IMG);
     evas_object_color_set(icon, BUTTON_COLOR);
 
-    elm_object_part_content_set(button, "button_center_part", icon);
-
-    evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(MessageInputPanel, onButtonClicked), this);
-    evas_object_smart_callback_add(button, "pressed", SMART_CALLBACK(MessageInputPanel, onButtonPressed), this);
-    evas_object_smart_callback_add(button, "unpressed", SMART_CALLBACK(MessageInputPanel, onButtonUnpressed), this);
+    elm_object_content_set(button, icon);
 
     return button;
 }