Apply font style for conv bubble items. 56/82256/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Tue, 2 Aug 2016 08:19:22 +0000 (11:19 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Tue, 2 Aug 2016 08:26:02 +0000 (11:26 +0300)
Change-Id: I5011a408098a14de77d162312756639f39f8b175
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
17 files changed:
inc/Resource.h
project_def.prop
res/edje/conv_genlist_theme.edc
res/edje/conv_label_theme.edc [new file with mode: 0644]
res/edje/conv_list_bubble.edc
src/Common/Controller/src/App.cpp
src/Common/Utils/inc/TextDecorator.h
src/Common/Utils/src/TextDecorator.cpp
src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp
src/Conversation/ConvList/View/inc/BubbleAudioViewItem.h
src/Conversation/ConvList/View/inc/BubbleBgViewItem.h
src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h
src/Conversation/ConvList/View/inc/BubbleIconTextLayoutItem.h
src/Conversation/ConvList/View/inc/BubbleUnknownFileViewItem.h
src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp
src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp
src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp

index 0e367a0..db6efb0 100644 (file)
@@ -38,6 +38,7 @@
 #define THREAD_THEME_EDJ_PATH            EDJ_PATH"/thread_genlist_theme.edj"
 
 #define CONV_GENLIST_THEME_EDJ_PATH      EDJ_PATH"/conv_genlist_theme.edj"
+#define CONV_LABEL_THEME_EDJ_PATH        EDJ_PATH"/conv_label_theme.edj"
 #define MSG_INPUT_PANEL_EDJ_PATH         EDJ_PATH"/msg_input_panel.edj"
 #define RECIPIENT_PANEL_EDJ_PATH         EDJ_PATH"/recipient_panel.edj"
 
index 76d6174..6af48bc 100644 (file)
@@ -35,7 +35,7 @@ USER_OBJS_ABS =
 
 # User Includes
 ## C Compiler
-USER_INC_DIRS = USER_INC_DIRS = src/Conversation/Utils/inc src/Common/SystemSettingsManager/inc inc src/Conversation/AppControl/inc src/Conversation/ConvList/Controller/inc src/Conversation/ConvList/View/inc src/Conversation/Main/Controller/inc src/Conversation/Main/View/inc src/Conversation/Recipients/Controller/inc src/Conversation/Recipients/View/inc src/Common/ContactManager/inc src/Common/AppControl/inc src/Conversation/Body/Controller/inc src/Conversation/ContactList/Controller/inc src/Conversation/ContactList/View/inc src/Conversation/Body/View/inc src/Settings/Controller/inc src/Settings/View/inc src/Viewer/Controller/inc src/Viewer/View/inc src/Viewer/Utils/inc src/MsgThread/Controller/inc src/MsgThread/View/inc src/Common/MsgEngine/inc src/Common/Utils/inc src/Common/View/inc src/Common/Controller/inc 
+USER_INC_DIRS = src/Conversation/Utils/inc src/Common/SystemSettingsManager/inc inc src/Conversation/AppControl/inc src/Conversation/ConvList/Controller/inc src/Conversation/ConvList/View/inc src/Conversation/Main/Controller/inc src/Conversation/Main/View/inc src/Conversation/Recipients/Controller/inc src/Conversation/Recipients/View/inc src/Common/ContactManager/inc src/Common/AppControl/inc src/Conversation/Body/Controller/inc src/Conversation/ContactList/Controller/inc src/Conversation/ContactList/View/inc src/Conversation/Body/View/inc src/Settings/Controller/inc src/Settings/View/inc src/Viewer/Controller/inc src/Viewer/View/inc src/Viewer/Utils/inc src/MsgThread/Controller/inc src/MsgThread/View/inc src/Common/MsgEngine/inc src/Common/Utils/inc src/Common/View/inc src/Common/Controller/inc 
 USER_INC_DIRS_ABS = 
 USER_INC_FILES = 
 USER_INC_FILES_ABS = 
@@ -60,7 +60,7 @@ USER_EDCS_FONT_DIRS_ABS =
 # EDC Flags
 USER_EXT_EDC_KEYS = EDC0 
 
-USER_EXT_EDC0_EDCS = res/edje/msg_title.edc res/edje/msg_body.edc res/edje/conv_layout.edc res/edje/viewer_layout.edc res/edje/msg_thread.edc res/edje/smil_item.edc res/edje/msg_input_panel.edc res/edje/select_all.edc res/edje/thread_genlist_theme.edc res/edje/recipient_panel.edc res/edje/viewer_player.edc res/edje/conv_list.edc res/edje/viewer_subject_layout.edc res/edje/conv_genlist_theme.edc res/edje/conv_contact_list_layout.edc res/edje/contact_search.edc res/edje/button_theme.edc res/edje/conv_list_bubble.edc res/edje/msg_thumbnail.edc res/edje/images.edc 
+USER_EXT_EDC0_EDCS = res/edje/msg_title.edc res/edje/msg_body.edc res/edje/conv_layout.edc res/edje/viewer_layout.edc res/edje/msg_thread.edc res/edje/smil_item.edc res/edje/msg_input_panel.edc res/edje/select_all.edc res/edje/thread_genlist_theme.edc res/edje/recipient_panel.edc res/edje/viewer_player.edc res/edje/conv_list.edc res/edje/viewer_subject_layout.edc res/edje/conv_genlist_theme.edc res/edje/conv_contact_list_layout.edc res/edje/conv_label_theme.edc res/edje/contact_search.edc res/edje/button_theme.edc res/edje/conv_list_bubble.edc res/edje/msg_thumbnail.edc res/edje/images.edc 
 USER_EXT_EDC0_EDCS_IMAGE_DIRS = edje/images res/images 
 USER_EXT_EDC0_EDCS_IMAGE_DIRS_ABS = 
 USER_EXT_EDC0_EDCS_SOUND_DIRS = edje/sounds 
index 2206059..32609e4 100755 (executable)
@@ -59,7 +59,7 @@ styles {
         tag:  "em" "+ font=Tizen:style=Oblique";
         tag:  "b" "+ font=Tizen:style=Bold";
         tag:  "link" "+ color=#800 underline=on underline_color=#8008";
-        tag:  "hilight" "+ font=Tizen:style=Bold";
+        tag:  "highlight" "+ font=Tizen:style=Bold";
         tag:  "match" "+ color=#FFFFFF color_class=T1067";
     }
     style {
@@ -69,7 +69,7 @@ styles {
         tag:  "em" "+ font=Tizen:style=Oblique";
         tag:  "b" "+ font=Tizen:style=Bold";
         tag:  "link" "+ color=#800 underline=on underline_color=#8008";
-        tag:  "hilight" "+ font=Tizen:style=Bold";
+        tag:  "highlight" "+ font=Tizen:style=Bold";
         tag:  "match" "+ color=#FFFFFF color_class=T1067";
     }
     style {
@@ -79,12 +79,12 @@ styles {
         tag:  "em" "+ font=Tizen:style=Oblique";
         tag:  "b" "+ font=Tizen:style=Bold";
         tag:  "link" "+ color=#00000080 underline=on underline_color=#00000080";
-        tag:  "hilight" "+ font=Tizen:style=Bold";
+        tag:  "highlight" "+ font=Tizen:style=Bold";
         tag:  "match" "+ color=#FFFFFF color_class=T1067";
     }
     style {
         name: "dateline_textblock_style";
-        base: "font=Tizen:style=Roman font_size="DATELINE_TEXT_SIZE" color=#"BUBBLE_DATELINE_TEXTSTYLE_COLOR_HEX" align=center";
+        base: "font=Tizen:style=Regular font_size="DATELINE_TEXT_SIZE" color=#"BUBBLE_DATELINE_TEXTSTYLE_COLOR_HEX" align=center";
     }
 }
 
diff --git a/res/edje/conv_label_theme.edc b/res/edje/conv_label_theme.edc
new file mode 100644 (file)
index 0000000..7b8d8ee
--- /dev/null
@@ -0,0 +1,44 @@
+#include "macros.inl"
+
+#define SLIDE_SPEED_WEIGHT 0.5
+#define SLIDE_TEXT_GAP 60
+#define SLIDE_TEXT_CHAR_GAP "      " //60 (6 spaces)
+#define SLIDE_TEXT_MAX_LENGTH (2*(1024+6))
+#define  LABEL_FONT_SIZE_INC 30
+
+collections {
+      BASE_SCALE;
+
+      styles {
+         style { name: "textblock_style";
+            base: "font=Samsung Condensed:style=Latin font_size="36" color=#080808ff wrap=mixed text_class=label align=left";
+            tag:  "br" "\n";
+            tag:  "ps" "ps";
+            tag:  "highlight" "+ font_weight=Bold";
+            tag:  "b" "+ font_weight=Bold";
+            tag:  "tab" "\t";
+         }
+      }
+
+      group { name: "elm/label/base/conv_bubble";
+         parts {
+            part { name: "label.text.clip";
+               type: RECT;
+               description { state: "default" 0.0;
+               }
+            }
+            part { name: "elm.text";
+               type: TEXTBLOCK;
+               scale: 1;
+               clip_to: "label.text.clip";
+               description { state: "default" 0.0;
+                  text {
+                     style: "textblock_style";
+                     min: 0 1;
+                     align: 0.0 0.0;
+                  }
+               }
+            }
+         }
+      }
+}
index da3dba0..9b6ce25 100644 (file)
@@ -24,22 +24,22 @@ collections {
     styles {
         style {
             name: "main_text_style";
-            base: "font=Samsung Condensed:style=Latin font_size="32" color=#000000 left_margin=1 right_margin=2 wrap=mixed ellipsis=1 align=left";
+            base: "font=Samsung Condensed:style=Latin font_size="36" color=#000000 left_margin=1 right_margin=2 wrap=mixed ellipsis=1 align=left";
             tag:  "tab" "\t";
             tag:  "em" "+ font=Tizen:style=Oblique";
             tag:  "b" "+ font=Tizen:style=Bold";
             tag:  "link" "+ color=#800 underline=on underline_color=#8008";
-            tag:  "hilight" "+ font=Tizen:style=Bold";
+            tag:  "highlight" "+ font=Tizen:style=Bold";
             tag:  "match" "+ color=#FFFFFF color_class=T1067";
         }
         style {
             name: "sub_text_style";
-            base: "font=Samsung Condensed:style=Latin font_size="28" color=#000000 left_margin=1 right_margin=2 wrap=mixed ellipsis=1 align=left";
+            base: "font=Samsung Condensed:style=Latin font_size="32" color=#000000 left_margin=1 right_margin=2 wrap=mixed ellipsis=1 align=left";
             tag:  "tab" "\t";
             tag:  "em" "+ font=Tizen:style=Oblique";
             tag:  "b" "+ font=Tizen:style=Bold";
             tag:  "link" "+ color=#800 underline=on underline_color=#8008";
-            tag:  "hilight" "+ font=Tizen:style=Bold";
+            tag:  "highlight" "+ font=Tizen:style=Bold";
             tag:  "match" "+ color=#FFFFFF color_class=T1067";
         }
     }
@@ -150,6 +150,21 @@ collections {
                 clip_to: "masking";
                 description {
                     state: "default" 0.0;
+                    color: 0 0 0 128;
+                }
+            }
+            part {
+                name: "press_effect";
+                type: IMAGE;
+                description {
+                    state: "default" 0.0;
+                    image.normal: "messages_attach_image_round_mask.#.png";
+                    color: 0 0 0 0;
+                }
+                description {
+                    state: "pressed" 0.0;
+                    inherit: "default";
+                    color: 0 0 0 70;
                 }
             }
             part {
@@ -162,6 +177,22 @@ collections {
                 }
             }
         }
+        programs {
+           program { name: "pressed";
+               signal: "mouse,down,1";
+               source: "*";
+               action: STATE_SET "pressed" 0.0;
+               target: "press_effect";
+               transition: LINEAR  0.1;
+           }
+           program { name: "unpressed";
+               signal: "mouse,up,1";
+               source: "*";
+               action: STATE_SET "default" 0.0;
+               target: "press_effect";
+               transition: LINEAR  0.1;
+           }
+       }
     }
 
     group {
@@ -218,7 +249,6 @@ collections {
                   image.normal: "messages_bubble_bg.#.png";
                   rel1 { relative: 0.0 0.0; }
                   rel2 { relative: 1.0 1.0; }
-                  min: 120 122;
                   color: BUBBLE_BG_COLOR;
                }
                description {
@@ -258,12 +288,14 @@ collections {
                signal: "mouse,down,1";
                source: "*";
                action: STATE_SET "pressed" 0.0;
+               transition: LINEAR  0.1;
                target: "bg";
            }
            program { name: "unpressed";
                signal: "mouse,up,1";
                source: "*";
                action: STATE_SET "default" 0.0;
+               transition: LINEAR  0.1;
                target: "bg";
            }
        }
index f71619e..debe966 100644 (file)
@@ -64,6 +64,9 @@ bool App::init()
     std::string threadThemePath = PathUtils::getResourcePath(THREAD_THEME_EDJ_PATH);
     elm_theme_extension_add(nullptr, threadThemePath.c_str());
 
+    std::string convLabelThemePath = PathUtils::getResourcePath(CONV_LABEL_THEME_EDJ_PATH);
+    elm_theme_extension_add(nullptr, convLabelThemePath.c_str());
+
     return true;
 }
 
index ec2a7e4..0d0de7e 100644 (file)
@@ -63,6 +63,7 @@ namespace Msg
     {
         public:
             static std::string make(const std::string &text, const TextStyle &style);
+            static std::string make(const std::string &text, const std::string &color);
             static std::string make(const std::string &text,
                                     int size = TextStyle::defaultFontSize,
                                     const std::string &color = TextStyle::defaultColor,
index e8f864f..e3b486f 100644 (file)
@@ -26,6 +26,7 @@ const char *TextStyle::defaultColor = "#000000FF";
 const char *TextStyle::whiteColor = "#FFFFFFFF";
 const int TextStyle::defaultFontSize = 28;
 
+#define OPEN_TAG_STR(name, str) "<" name "=" + str + ">"
 #define OPEN_TAG(name, val) "<" name "=" << (val) << ">"
 #define CLOSE_TAG(name) "</" name ">"
 
@@ -105,6 +106,12 @@ std::string TextDecorator::make(const std::string &text, const TextStyle &style)
     return make(text, style.getSize(), style.getColor(), style.getAlign());
 }
 
+std::string TextDecorator::make(const std::string &text, const std::string &color)
+{
+    std::string res = OPEN_TAG_STR("color", color) + text + CLOSE_TAG("color");
+    return res;
+}
+
 std::string TextDecorator::make(const std::string &text,
                                 int size,
                                 const std::string &color,
index 34558bd..e33dcc1 100644 (file)
@@ -57,7 +57,7 @@ BubbleContactViewItem *BubbleContactEntity::createView(Evas_Object *parent)
     auto *item = new BubbleContactViewItem(*this, parent, m_BgType, type);
     item->setMainText(m_Name);
 
-    Evas_Object *thumb = m_ThumbPath.empty() ? BubbleContactViewItem::createIcon(*item, ATTACH_CONTACT_ICON)
+    Evas_Object *thumb = m_ThumbPath.empty() ? item->createIcon(ATTACH_CONTACT_ICON)
                                              : m_ThumbMaker.getThumb(*item, m_ThumbPath, BubbleContactViewItem::iconSize);
     if(thumb)
         item->setIcon(thumb);
index 6eee068..8ae04f2 100644 (file)
@@ -34,7 +34,7 @@ namespace Msg
     inline BubbleAudioViewItem::BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType)
         : BubbleIconTextLayoutItem(entity, parent, bgType, Layout1Icon2Text)
     {
-        setIcon(createIcon(getContent(), ATTACH_MUSIC_ICON));
+        setIcon(createIcon(ATTACH_MUSIC_ICON));
     }
 
     inline BubbleAudioViewItem::~BubbleAudioViewItem()
index d975dda..422652d 100644 (file)
@@ -38,9 +38,18 @@ namespace Msg
             BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType);
             virtual ~BubbleBgViewItem();
 
+            BgType getBgType() const;
             void showSearch(bool search);
             void setContent(Evas_Object *obj);
             Evas_Object *getContent() const;
+
+            static std::string applyColor(const std::string &text, BgType bgType);
+            static void applyColor(Evas_Object *obj, BgType bgType);
+            std::string applyColor(const std::string &text) const;
+            void applyColor(Evas_Object *obj) const;
+
+        private:
+            BgType m_BgType;
     };
 }
 
index 0db86a2..538feb5 100644 (file)
@@ -34,7 +34,7 @@ namespace Msg
     inline BubbleCalEventViewItem::BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType layoutType)
         : BubbleIconTextLayoutItem(entity, parent, bgType, layoutType)
     {
-        setIcon(createIcon(getContent(), ATTACH_CAL_ICON));
+        setIcon(createIcon(ATTACH_CAL_ICON));
     }
 
     inline BubbleCalEventViewItem::~BubbleCalEventViewItem()
index bdd3f1d..25c8940 100644 (file)
@@ -42,7 +42,8 @@ namespace Msg
             void setMainText(const std::string &text);
             void setSubText(const std::string &text);
 
-            static Evas_Object *createIcon(Evas_Object *parent, const std::string &edjFileName);
+            static Evas_Object *createIcon(Evas_Object *parent, const std::string &edjFileName, BgType bgType);
+            Evas_Object *createIcon(const std::string &edjFileName) const;
 
         private:
             LayoutType m_LayoutType;
index be261d7..c5062de 100644 (file)
@@ -34,7 +34,7 @@ namespace Msg
     inline BubbleUnknownFileViewItem::BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType)
         : BubbleIconTextLayoutItem(entity, parent, bgType, Layout1Icon1Text)
     {
-        setIcon(createIcon(getContent(), ATTACH_UNKNOWN_ICON));
+        setIcon(createIcon(ATTACH_UNKNOWN_ICON));
     }
 
     inline BubbleUnknownFileViewItem::~BubbleUnknownFileViewItem()
index 6521ebe..33062c4 100644 (file)
 
 #include "BubbleBgViewItem.h"
 #include "Resource.h"
+#include "TextDecorator.h"
 
 using namespace Msg;
+const std::string whiteTextColor = "#fafafa";
+const std::string darkTextColor = "#808080";
+#define WHITE_OBJ_COLOR  250, 250, 250, 255
+#define DARK_OBJ_COLOR  128, 128, 128, 255
 
 BubbleBgViewItem::BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType)
     : BubbleViewItem(entity)
+    , m_BgType(bgType)
 {
     const char *group = nullptr;
     switch(bgType)
@@ -50,6 +56,11 @@ BubbleBgViewItem::~BubbleBgViewItem()
 
 }
 
+BubbleBgViewItem::BgType BubbleBgViewItem::getBgType() const
+{
+    return m_BgType;
+}
+
 void BubbleBgViewItem::setContent(Evas_Object *obj)
 {
     View::setContent(obj, "content");
@@ -64,3 +75,28 @@ void BubbleBgViewItem::showSearch(bool search)
 {
     // TODO: impl
 }
+
+std::string BubbleBgViewItem::applyColor(const std::string &text, BgType bgType)
+{
+    const std::string &color = (bgType == SentStyle || bgType == ReceivedStyle) ? whiteTextColor : darkTextColor;
+    return TextDecorator::make(text, color);
+}
+
+void BubbleBgViewItem::applyColor(Evas_Object *obj, BgType bgType)
+{
+    if(bgType == SentStyle || bgType == ReceivedStyle)
+        evas_object_color_set(obj, WHITE_OBJ_COLOR);
+    else
+        evas_object_color_set(obj, DARK_OBJ_COLOR);
+}
+
+std::string BubbleBgViewItem::applyColor(const std::string &text) const
+{
+    return applyColor(text, m_BgType);
+}
+
+void BubbleBgViewItem::applyColor(Evas_Object *obj) const
+{
+    applyColor(obj, m_BgType);
+}
+
index 133edf3..0a45d96 100644 (file)
@@ -20,9 +20,9 @@
 #include "TextDecorator.h"
 #include "Resource.h"
 
-using namespace Msg;
+#include "TextDecorator.h"
 
-#define DEF_ICON_COLOR  128, 128, 128, 255
+using namespace Msg;
 
 BubbleIconTextLayoutItem::BubbleIconTextLayoutItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType layoutType)
     : BubbleBgViewItem(entity, parent, bgType)
@@ -42,6 +42,7 @@ BubbleIconTextLayoutItem::BubbleIconTextLayoutItem(BubbleEntity &entity, Evas_Ob
     }
 
     m_pIconTextLayout = addLayout(getEo(), CONV_LIST_BUBBLE_EDJ_PATH, group);
+    evas_object_smart_calculate(m_pIconTextLayout);
     setContent(m_pIconTextLayout);
 }
 
@@ -56,24 +57,29 @@ void BubbleIconTextLayoutItem::setIcon(Evas_Object *icon)
 
 void BubbleIconTextLayoutItem::setMainText(const std::string &text)
 {
-    elm_object_part_text_set(m_pIconTextLayout, "main.text", text.c_str());
+    elm_object_part_text_set(m_pIconTextLayout, "main.text", applyColor(text).c_str());
 }
 
 void BubbleIconTextLayoutItem::setSubText(const std::string &text)
 {
-    elm_object_part_text_set(m_pIconTextLayout, "sub.text", text.c_str());
+    elm_object_part_text_set(m_pIconTextLayout, "sub.text", applyColor(text).c_str());
 }
 
-Evas_Object *BubbleIconTextLayoutItem::createIcon(Evas_Object *parent, const std::string &edjFileName)
+Evas_Object *BubbleIconTextLayoutItem::createIcon(Evas_Object *parent, const std::string &edjFileName, BgType bgType)
 {
     Evas_Object *icon = elm_icon_add(parent);
     std::string resPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH);
     elm_image_file_set(icon, resPath.c_str(), edjFileName.c_str());
-    evas_object_color_set(icon, DEF_ICON_COLOR);
+    applyColor(icon, bgType);
     evas_object_show(icon);
     return icon;
 }
 
+Evas_Object *BubbleIconTextLayoutItem::createIcon(const std::string &edjFileName) const
+{
+    return createIcon(*this, edjFileName, getBgType());
+}
+
 BubbleIconTextLayoutItem::LayoutType BubbleIconTextLayoutItem::getLayoutType() const
 {
     return m_LayoutType;
index 33967ae..332a7d2 100644 (file)
  */
 
 #include "BubbleTextViewItem.h"
+#include "Resource.h"
+#include "Logger.h"
 
 using namespace Msg;
 
-namespace
-{
-    const char *textStyle = "DEFAULT='font=Tizen:style=Regular font_size=24 wrap=mixed text_class=label'";
-}
-
 BubbleTextViewItem::BubbleTextViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, const std::string &text)
     : BubbleBgViewItem(entity, parent, bgType)
 {
-    setContent(createText(*this, text));
+    setContent(createText(*this, applyColor(text)));
 }
 
 BubbleTextViewItem::~BubbleTextViewItem()
@@ -36,30 +33,24 @@ BubbleTextViewItem::~BubbleTextViewItem()
 
 Evas_Object *BubbleTextViewItem::createText(Evas_Object *parent, const std::string &text)
 {
-    //TODO: apply to label the same text style as to textblock (figure out how-to)
     if(text.empty())
         return nullptr;
 
-    Evas_Coord ww = 0;
-    Evas_Coord hh = 0;
-
     Evas_Object *label = elm_label_add(parent);
-    Evas_Object *textBlock = evas_object_textblock_add(evas_object_evas_get(label));
-    Evas_Textblock_Style *ts = evas_textblock_style_new();
-
-    evas_textblock_style_set(ts, textStyle);
-    evas_object_textblock_style_set(textBlock, ts);
-    evas_object_textblock_text_markup_set(textBlock, text.c_str());
-    evas_object_textblock_size_native_get(textBlock, &ww, &hh);
-
-    evas_textblock_style_free(ts);
-    evas_object_del(textBlock);
-
-    int wrapWidth = ww > maxWidth ? (int)ELM_SCALE_SIZE(maxWidth) : (int)ELM_SCALE_SIZE(ww);
+    elm_object_style_set(label, "conv_bubble");
 
     elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
-    elm_label_wrap_width_set(label, wrapWidth);
     elm_object_part_text_set(label, nullptr, text.c_str());
     evas_object_show(label);
+
+    Evas_Object *edjeLabel = elm_layout_edje_get(label);
+    const Evas_Object *textBlock = edje_object_part_object_get(edjeLabel, "elm.text");
+
+    Evas_Coord ww = 0;
+    Evas_Coord hh = 0;
+    evas_object_textblock_size_native_get(textBlock, &ww, &hh);
+    int wrapWidth = ww > maxWidth ? maxWidth : ww;
+    elm_label_wrap_width_set(label, wrapWidth);
+
     return label;
 }