TizenRefApp-7064 Implementation unread icon in message thread (GUI part) 27/86927/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 5 Sep 2016 12:36:08 +0000 (15:36 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 5 Sep 2016 12:36:08 +0000 (15:36 +0300)
Change-Id: I2ca10eda2de3eca2d152d0defc186c0793d8ebfd
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
edje/images/core_icon_badge_container.#.png [new file with mode: 0755]
res/edje/icons.edc
src/MsgThread/Controller/src/ThreadListItem.cpp
src/MsgThread/View/inc/ThreadListViewItem.h
src/MsgThread/View/src/ThreadListViewItem.cpp

diff --git a/edje/images/core_icon_badge_container.#.png b/edje/images/core_icon_badge_container.#.png
new file mode 100755 (executable)
index 0000000..b999e46
Binary files /dev/null and b/edje/images/core_icon_badge_container.#.png differ
index 45999e8..b40962f 100755 (executable)
@@ -141,4 +141,54 @@ collections {
            }
        }
    }
+   group {
+        name: "badge";
+        images {
+            image: "core_icon_badge_container.#.png" RAW; // TODO: replace image with 50x50px
+        }
+        parts
+        {
+            part{ name: "elm.image.count.bg";
+                type:IMAGE;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 0 1;
+                    min: 50 50;
+                    max: -1 50;
+                    image {
+                        normal:"core_icon_badge_container.#.png";
+                    }
+                    color: 0 0 0 32;
+
+                }
+            }
+            PADDING_LEFT("pad.left", 13);
+            PADDING_RIGHT("pad.right", 13);
+            part { name: "elm.text.count";
+                type: TEXT;
+                mouse_events: 0;
+                scale: 1;
+                description { state: "default" 0.0;
+                    align: 0.5 0.5;
+                    rel1 {
+                        relative: 1.0 0.5;
+                        to_x: "pad.left";
+                    }
+                    rel2 {
+                        relative: 0.0 0.5;
+                        to_x: "pad.right";
+                    }
+                    color: 250 250 250 255;
+                    text {
+                        font: "Tizen:style=Regular";
+                        size: 32;
+                        ellipsis: 0.0;
+                        align: 0.5 0.5;
+                        min: 1 0;
+                    }
+                }
+            }
+        }
+    }
 }
index fe07c51..d64b5f8 100644 (file)
@@ -88,7 +88,7 @@ void ThreadListItem::update(const MsgThreadItem &threadItem)
             if(count > 0)
             {
                 state = IconState;
-                m_UnreadCount = decorateUnreadText(std::to_string(count));
+                m_UnreadCount = std::to_string(count);
             }
         }
     }
index 0e65c68..38e8491 100644 (file)
@@ -54,7 +54,6 @@ namespace Msg
             std::string decorateNameText(const std::string &text) const;
             std::string decorateMessageText(const std::string &text) const;
             std::string decorateTimeText(const std::string &text) const;
-            std::string decorateUnreadText(const std::string &text) const;
             std::string decorateFailedText(const std::string &text) const;
             std::string decorateSendingText(const std::string &text) const;
             std::string decorateDraftText(const std::string &text) const;
index 47f9b2e..d9deb94 100644 (file)
@@ -21,6 +21,7 @@
 #include "ThumbnailMaker.h"
 #include "ListView.h"
 #include "TextDecorator.h"
+#include "Resource.h"
 
 #include <Elementary.h>
 #include <stdlib.h>
@@ -119,11 +120,12 @@ ThreadListViewItem::State ThreadListViewItem::getState() const
 
 Evas_Object *ThreadListViewItem::makeUnreadIcon(const std::string &text) const
 {
-    Evas_Object *label = elm_label_add(*getOwner());
-    evas_object_show(label);
-    std::string decorText = TextDecorator::make(text, unreadTextStyle);
-    elm_object_text_set(label, decorText.c_str());
-    return label;
+    if(text.empty())
+        return nullptr;
+    Evas_Object *icon = View::addLayout(*getOwner(), ICONS_EDJ_PATH, "badge");
+    elm_object_part_text_set(icon,  "elm.text.count", text.c_str());
+    evas_object_show(icon);
+    return icon;
 }
 
 std::string ThreadListViewItem::getStatus()
@@ -154,11 +156,6 @@ std::string ThreadListViewItem::decorateTimeText(const std::string &text) const
     return text;
 }
 
-std::string ThreadListViewItem::decorateUnreadText(const std::string &text) const
-{
-    return TextDecorator::make(text, unreadTextStyle);
-}
-
 std::string ThreadListViewItem::decorateFailedText(const std::string &text) const
 {
     return TextDecorator::make(text, failedTextStyle);