New GUI for ContactLis. Fixed set style to ConvListViewItem 16/83216/5
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Tue, 9 Aug 2016 12:21:19 +0000 (15:21 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Wed, 10 Aug 2016 11:25:16 +0000 (04:25 -0700)
Change-Id: Iee3944d6a4a9ded711d68dd9c25c51816ed13078
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
res/edje/conv_contact_list_layout.edc
src/Common/View/inc/View.h
src/Conversation/ContactList/View/inc/ConvContactListView.h
src/Conversation/ContactList/View/src/ConvContactListView.cpp
src/Conversation/ConvList/View/inc/ConvListViewItem.h
src/Conversation/ConvList/View/src/ConvListViewItem.cpp

index eb4cda9281222e0f6fa60606881ac89c4ece522a..5d59af0a5f813f6b4ab159d34110d036fab19682 100755 (executable)
@@ -1,50 +1,98 @@
-collections {
-
-       base_scale: 1.8;
+#include "macros.inl"
 
-       group
-       {
-               name: "conv_contact_list_layout";
-               parts {
-                       part {
-                               name: "swl.rect";
-                               type: SWALLOW;
-                               scale: 1;
-                               repeat_events: 1;
-                               description {
-                                       state: "default" 0.0;
-                                       rel1 {relative: 0.0 0.0;}
-                                       rel2 {relative: 1.0 1.0;}
-                                       align: 0 0.0;
-                                       visible: 1;
-                                       fixed: 1 1;
-                               }
-                       }
-                       part {
-                               name: "bg_rect";
-                               type: RECT;
-                               scale: 1;
-                               description {
-                                       state: "default" 0.0;
-                                       color: 255 255 255 255;
-                                       rel1 {to: "swl.contact_list"; relative: 0.0 0.0;}
-                                       rel2 {to: "swl.contact_list"; relative: 1.0 1.0;}
-                                       visible: 1;
-                                       align: 0 0.0;
-                                       fixed: 1 1;
-                               }
-                       }
-                       part {
-                               name: "swl.contact_list";
-                               type: SWALLOW;
-                               scale: 1;
-                               description {
-                                       state: "default" 0.0;
-                                       visible: 1;
-                                       align: 0 0;
-                                       fixed: 1 1;
-                               }
-                       }
-               }
-       }
+collections {
+    BASE_SCALE;
+    group
+    {
+        images {
+           image: "messages_bubble_line_draft.#.png" RAW;
+        }
+        name: "conv_contact_list_layout";
+        parts {
+            part {
+                name: "pad.left";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 32 0;
+                    fixed: 1 0;
+                    rel1{relative: 0.0 0.0;}
+                    rel2{relative: 0.0 1.0;}
+                    align: 0.0 0.0;
+                }
+            }
+            part {
+                name: "pad.right";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 120 0;
+                    fixed: 1 0;
+                    rel1{relative: 1.0 0.0;}
+                    rel2{relative: 1.0 1.0;}
+                    align: 1.0 0.0;
+                }
+            }
+            part {
+                name: "pad.bottom";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 0 120;
+                    fixed: 0 1;
+                    rel1{relative: 0.0 1.0;}
+                    rel2{relative: 1.0 1.0;}
+                    align: 0.0 1.0;
+                }
+            }
+            part {
+                name: "metric";
+                type: SPACER;
+                scale: 1;
+                repeat_events: 1;
+                description {
+                    state: "default" 0.0;
+                    rel1 { to_x: "pad.left"; relative: 1.0 0.0; }
+                    rel2 { to_x: "pad.right"; to_y: "pad.bottom"; relative: 0.0 0.0; }
+                }
+            }
+            part {
+                name: "bg";
+                type: RECT;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0 0;
+                    rel1 { to: "swl.contact_list"; relative: 0.0 0.0; }
+                    rel2 { to: "swl.contact_list"; relative: 1.0 1.0; }
+                    color: 235 235 255 255;
+                }
+            }
+            part {
+                name: "swl.contact_list";
+                type: SWALLOW;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0 0;
+                    rel1 { to: "metric"; relative: 0.0 0.0; }
+                    rel2 { to: "metric"; relative: 1.0 0.0; }
+                }
+            }
+            part {
+               name: "frame";
+               repeat_events: 1;
+               description {
+                  state: "default";
+                  image.normal: "messages_bubble_line_draft.#.png";
+                  rel1 { to: "swl.contact_list"; relative: 0.0 0.0; }
+                  rel2 { to: "swl.contact_list"; relative: 1.0 1.0; }
+                  color: 65 197 217 255;
+               }
+           }
+        }
+    }
 }
index 93e22f05879f6e32a5c18c21235fbeb667e6b9fe..cda1106bf120926030a701f93483210f8841de35 100644 (file)
@@ -278,6 +278,12 @@ namespace Msg
              */
             void setText(const TText &text, const char *part = nullptr);
 
+            /**
+             * @brief Gets the edje object
+             * @return edje object
+             */
+            Evas_Object *getEdje() const;
+
             static void setText(Evas_Object *obj, const TText &text, const char *part = nullptr);
 
             static Evas_Object *addLayout(Evas_Object *parent, const std::string &edjePath, const std::string &group);
@@ -528,6 +534,11 @@ namespace Msg
     {
         return elm_object_part_content_unset(m_pEo, part);
     }
+
+    inline Evas_Object *View::getEdje() const
+    {
+        return elm_layout_edje_get(m_pEo);
+    }
 }
 
 #endif /* View_h_ */
index 2d7d9d72573cf84a5d9f07f63c9dc54c8eb5150f..b49aff3cdb06ac35f9cef3a0d82e4e0e23582be3 100644 (file)
@@ -33,15 +33,12 @@ namespace Msg
             const ListView &getList() const;
 
         private:
-            int getItemHeight() const;
             void recalcGeometry();
-            Evas_Object *createRect(Evas_Object *parent);
             void onGometryChanged(Evas_Object *obj, void *eventInfo);
 
         private:
-            Evas_Object *m_pRect;
-            Evas_Object *m_pBox;
             ListView *m_pList;
+            Evas_Object *m_pGrid;
     };
 }
 
index 514f851a160e745f3429e3b1ba9e962ea8098629..9ebfaa39ca340f6023cee1f5966f765962480178 100644 (file)
 
 #include "ConvContactListView.h"
 #include "Resource.h"
+#include "Logger.h"
 
 using namespace Msg;
 
 ConvContactListView::ConvContactListView(Evas_Object *parent)
-    : m_pRect(nullptr)
-    , m_pBox(nullptr)
-    , m_pList(nullptr)
+    : m_pList(nullptr)
+    , m_pGrid(nullptr)
 {
     setEo(addLayout(parent, CONV_CONTACT_LIST_LAYOUT, "conv_contact_list_layout"));
     setFocusAllow(false);
+    addEventCb(EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
 
-    m_pList = new ListView(getEo());
+    m_pGrid = elm_grid_add(*this);
+
+    m_pList = new ListView(m_pGrid);
     m_pList->setMultiSelection(true);
     m_pList->setMode(ELM_LIST_COMPRESS);
     m_pList->setHomogeneous(true);
     m_pList->setFocusAllow(false);
-    m_pList->addSmartCb("realized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
-    m_pList->addSmartCb("unrealized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
-    m_pList->expand();
+    m_pList->addEventCb(EVAS_CALLBACK_CHANGED_SIZE_HINTS, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
     m_pList->show();
+    elm_scroller_content_min_limit(*m_pList, false, true);
 
-    m_pBox = elm_box_add(getEo());
-    evas_object_show(m_pBox);
-    elm_box_pack_end(m_pBox, *m_pList);
-
-    setContent(m_pBox, "swl.contact_list");
-    setContent(createRect(getEo()), "swl.rect");
+    elm_grid_pack(m_pGrid, *m_pList, 0, 0, 100, 100);
+    setContent(m_pGrid, "swl.contact_list");
 }
 
 ConvContactListView::~ConvContactListView()
@@ -63,52 +61,17 @@ const ListView &ConvContactListView::getList() const
 
 void ConvContactListView::recalcGeometry()
 {
-    int itemHeight = getItemHeight();
-
-    int h = itemHeight * m_pList->getItemsCount();
+    int maxHeight = 0;
+    int width = 0;
+    edje_object_part_geometry_get(getEdje(), "metric", nullptr, nullptr, &width, &maxHeight);
 
-    int maxListHeight = 0;
-    evas_object_geometry_get(m_pRect, nullptr, nullptr, nullptr, &maxListHeight);
+    int h = 0;
+    evas_object_size_hint_min_get(*m_pList, nullptr, &h);
 
-    if(h > maxListHeight)
-        h = maxListHeight;
-
-    evas_object_size_hint_min_set(m_pBox, 0, h);
-    evas_object_size_hint_max_set(m_pBox, -1, h);
-}
+    if(h > maxHeight)
+        h = maxHeight;
 
-int ConvContactListView::getItemHeight() const
-{
-    int res = 0;
-    Evas_Object *track = nullptr;
-    Elm_Object_Item *item = elm_genlist_first_item_get(*m_pList);
-
-    for(; item ;)
-    {
-        track = elm_object_item_track(item);
-        if(track)
-            break;
-        item = elm_genlist_item_next_get(item);
-    }
-
-    if(track)
-    {
-        evas_object_geometry_get(track, nullptr, nullptr, nullptr, &res);
-        elm_object_item_untrack(track);
-    }
-
-    return res;
-}
-
-Evas_Object *ConvContactListView::createRect(Evas_Object *parent)
-{
-    m_pRect = evas_object_rectangle_add(evas_object_evas_get(parent));
-    evas_object_show(m_pRect);
-    evas_object_color_set(m_pRect, 0, 0, 0, 0);
-    evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_MOVE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
-    evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
-    evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_CHANGED_SIZE_HINTS, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
-    return m_pRect;
+    evas_object_size_hint_min_set(m_pGrid, width, h);
 }
 
 void ConvContactListView::onGometryChanged(Evas_Object *obj, void *eventInfo)
index 4f80687e7cb2babebe64d95f78b89af6740d816f..87df26c407ab0284cd4e4add90ff694afbc614f3 100644 (file)
@@ -28,6 +28,7 @@ namespace Msg
         public:
             enum ConvItemType
             {
+                InitType,
                 Sent,
                 Received,
                 Draft,
@@ -64,6 +65,7 @@ namespace Msg
 
         private:
             bool m_SearchMode;
+            ConvItemType m_Type;
     };
 }
 
index 289601d97f100d3346f2758cbf2126e5d5979782..eba6005c570a24392b626d24007084bb7a2da73c 100644 (file)
@@ -43,6 +43,7 @@ namespace
 ConvListViewItem::ConvListViewItem(ConvItemType type)
     : ListItem()
     , m_SearchMode(false)
+    , m_Type(InitType)
 {
     updateItemType(type);
 }
@@ -175,6 +176,10 @@ void ConvListViewItem::updateProgressField()
 
 void ConvListViewItem::updateItemType(ConvItemType type)
 {
+    if(type == m_Type || type == InitType)
+        return;
+
+    m_Type = type;
     switch (type)
     {
         case Sent: