TSAM-11757 Field Notes does not change font size as the others fields 99/105699/2
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Mon, 19 Dec 2016 09:42:20 +0000 (11:42 +0200)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 19 Dec 2016 12:21:00 +0000 (04:21 -0800)
Change-Id: I74afac211e6744fff2535c5b813b308fd6b405f5
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
lib-common/res/details/edje/DetailsItemLayout.h
lib-common/res/details/edje/details-item-layout.edc
lib-contacts/inc/Contacts/Details/MultilineFieldItem.h
lib-contacts/src/Contacts/Details/MultilineFieldItem.cpp

index f9e8b2f..953e7f5 100644 (file)
@@ -17,7 +17,9 @@
 #ifndef DETAILS_ITEM_LAYOUT_H
 #define DETAILS_ITEM_LAYOUT_H
 
-#define STYLE_ITEM_DETAILS  "details"
-#define PART_THUMBNAIL      "swallow.thumbnail"
+#define STYLE_ITEM_DETAILS          "details"
+#define STYLE_ITEM_MULTILINE_SUB    "multiline_sub"
+
+#define PART_THUMBNAIL              "swallow.thumbnail"
 
 #endif /* DETAILS_ITEM_LAYOUT_H */
index e1a4af9..ad6aa58 100644 (file)
 #define THUMBNAIL_T  60
 #define THUMBNAIL_B  110
 
+#define MULTILINE_LR 32
+#define MULTILINE_TB 24
+
+#define TEXT_H       54
+#define SUBTEXT_H    43
+
+styles {
+       style {
+               name: "text";
+               base: "font=Tizen:style=Light font_size=40 wrap=mixed color=#000000 text_class=list_item";
+       }
+       style {
+               name: "subtext";
+               base: "font=Tizen:style=Regular font_size=32 color=#737373 text_class=list_item ellipsis=1.0";
+       }
+}
+
 collections
 {
        base_scale: 2.6;
@@ -56,4 +73,54 @@ collections
                        }
                }
        }
+
+       group { "elm/genlist/item/"STYLE_ITEM_MULTILINE_SUB"/default";
+               alias: "elm/genlist/item_compress/"STYLE_ITEM_MULTILINE_SUB"/default";
+               alias: "elm/genlist/tree/"STYLE_ITEM_MULTILINE_SUB"/default";
+               alias: "elm/genlist/tree_compress/"STYLE_ITEM_MULTILINE_SUB"/default";
+
+               data.item: "texts" "elm.text elm.text.sub";
+               data.item: "banded_bg_area" "elm.swallow.bg";
+
+               parts {
+                       swallow { "elm.swallow.bg"; }
+                       spacer { "spacer.left_top"; scale;
+                               desc { "default";
+                                       min: MULTILINE_LR MULTILINE_TB;
+                                       align: 0.0 0.0;
+                                       rel2.relative: 0.0 0.0;
+                               }
+                       }
+                       spacer { "spacer.right_bottom"; scale;
+                               desc { "default";
+                                       min: MULTILINE_LR MULTILINE_TB;
+                                       align: 1.0 1.0;
+                                       rel1.relative: 1.0 1.0;
+                               }
+                       }
+                       textblock { "elm.text.sub"; scale;
+                               desc { "default";
+                                       min: 0 SUBTEXT_H;
+                                       align: 0.5 0.0;
+                                       rel1 { relative: 1.0 1.0; to: "spacer.left_top"; }
+                                       rel2 { relative: 0.0 1.0; to_x: "spacer.right_bottom"; to_y: "spacer.left_top"; }
+                                       text {
+                                               min: 0 1;
+                                               style: "subtext";
+                                       }
+                               }
+                       }
+                       textblock { "elm.text"; scale;
+                               desc { "default";
+                                       min: 0 TEXT_H;
+                                       rel1 { relative: 1.0 1.0; to_x: "spacer.left_top"; to_y: "elm.text.sub"; }
+                                       rel2 { relative: 0.0 0.0; to: "spacer.right_bottom"; }
+                                       text {
+                                               min: 0 1;
+                                               style: "text";
+                                       }
+                               }
+                       }
+               }
+       }
 }
index 2a71378..a4fe832 100644 (file)
@@ -36,19 +36,6 @@ namespace Contacts
                         * @see GenItem::getItemClass()
                         */
                        virtual Elm_Genlist_Item_Class *getItemClass() const override;
-
-                       /**
-                        * @see GenItem::getText()
-                        */
-                       virtual char *getText(Evas_Object *parent, const char *part) override;
-
-                       /**
-                        * @see FieldItem::onFieldUpdated()
-                        */
-                       virtual void onFieldUpdated(Model::ContactField &field, contacts_changed_e change) override;
-
-               private:
-                       static char *formatText(const char *textStyle, int textSize, const char *textColor, const char *text);
                };
        }
 }
index 914e32a..0e96c0e 100644 (file)
  */
 
 #include "Contacts/Details/MultilineFieldItem.h"
-
-#define TEXT_MARKUP "<font=Tizen:style=%s font_size=%d color=#%s>"
-#define TEXT_MARKUP_SIZE sizeof(TEXT_MARKUP)
-
-#define TEXT_STYLE "Light"
-#define TEXT_SIZE 40
-#define TEXT_COLOR "000"
-
-#define SUBTEXT_STYLE "Normal"
-#define SUBTEXT_SIZE 32
-#define SUBTEXT_COLOR "737373"
+#include "DetailsItemLayout.h"
 
 using namespace Contacts::Details;
 using namespace Contacts::Model;
 
 Elm_Genlist_Item_Class *MultilineFieldItem::getItemClass() const
 {
-       static Elm_Genlist_Item_Class itc = createItemClass("multiline");
+       static Elm_Genlist_Item_Class itc = createItemClass(STYLE_ITEM_MULTILINE_SUB);
        return &itc;
 }
-
-char *MultilineFieldItem::getText(Evas_Object *parent, const char *part)
-{
-       const char *textStyle = nullptr;
-       int textSize = 0;
-       const char *textColor = nullptr;
-
-       if (strcmp(part, "elm.text.multiline") == 0) {
-               part = "elm.text";
-               textStyle = TEXT_STYLE;
-               textSize = TEXT_SIZE;
-               textColor = TEXT_COLOR;
-       } else if (strcmp(part, "elm.text") == 0) {
-               part = "elm.text.sub";
-               textStyle = SUBTEXT_STYLE;
-               textSize = SUBTEXT_SIZE;
-               textColor = SUBTEXT_COLOR;
-       }
-
-       char *text = FieldItem::getText(parent, part);
-       if (text) {
-               char *formattedText = formatText(textStyle, textSize, textColor, text);
-               free(text);
-               return formattedText;
-       }
-
-       return nullptr;
-}
-
-void MultilineFieldItem::onFieldUpdated(ContactField &field, contacts_changed_e change)
-{
-       if (&field == &getField()) {
-               elm_genlist_item_fields_update(getObjectItem(), "elm.text.multiline", ELM_GENLIST_ITEM_FIELD_TEXT);
-       } else {
-               FieldItem::onFieldUpdated(field, change);
-       }
-}
-
-char *MultilineFieldItem::formatText(const char *textStyle, int textSize, const char *textColor, const char *text)
-{
-       size_t size = strlen(text) + strlen(textStyle) + strlen(textColor) + TEXT_MARKUP_SIZE;
-       char *buffer = (char *) malloc(size);
-       snprintf(buffer, size, TEXT_MARKUP "%s", textStyle, textSize, textColor, text);
-       return buffer;
-}