TizenRefApp-8224 Implement Image and Video bubble items for conversation 12/120912/4
authorOleksander Kostenko <o.kostenko@samsung.com>
Fri, 24 Mar 2017 15:37:45 +0000 (17:37 +0200)
committerOleksander Kostenko <o.kostenko@samsung.com>
Tue, 28 Mar 2017 13:22:42 +0000 (16:22 +0300)
Change-Id: I7e6d6a86691f4e471aaf092dd6c957082c61a005
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
14 files changed:
inc/Resource.h
res/edje/conv_genlist_theme.edc
res/edje/conv_list_bubble.edc [new file with mode: 0644]
res/images/cat.png [new file with mode: 0644]
src/Conversation/Controller/inc/BubbleImageEntity.h [new file with mode: 0644]
src/Conversation/Controller/inc/BubbleVideoEntity.h [new file with mode: 0644]
src/Conversation/Controller/src/BubbleVideoEntity.cpp [new file with mode: 0644]
src/Conversation/Controller/src/ConvList.cpp
src/Conversation/View/inc/BubbleImageViewItem.h [new file with mode: 0644]
src/Conversation/View/inc/BubbleVideoViewItem.h [new file with mode: 0644]
src/Conversation/View/src/BubbleIconTextLayoutItem.cpp
src/Conversation/View/src/BubbleImageViewItem.cpp [new file with mode: 0644]
src/Conversation/View/src/BubbleSubjectViewItem.cpp
src/Conversation/View/src/BubbleViewItem.cpp

index f0854b6100728ada53698ca948628f1563e144cd..7cc6ff8a9f3e80fe30af77d642af5387f4e942d3 100644 (file)
 #define IMAGE_PATH "images"
 #define MORE_OPTION_DIR "More_option_icon"
 
-// Res images
+// Edj images:
 #define ATTACH_VOICE_ICON               "thread_view_msg_att_voice.png"
 #define ATTACH_MUSIC_ICON               "thread_view_msg_att_music.png"
 #define ATTACH_CALENDAR_ICON            "thread_view_msg_att_schedule.png"
 #define ATTACH_CONTACT_ICON             "thread_view_msg_att_vcf.png"
 
+#define TEST_IMAGE_PATH                  "images/cat.png"
 
-// Edj images:
 #define NEW_MSG_MORE_ICON                MORE_OPTION_DIR"/b_more_option_ic_compose.png"
 #define DELETEG_MORE_ICON                MORE_OPTION_DIR"/b_more_option_ic_delete.png"
 #define ADD_TO_SPAM_MORE_ICON            MORE_OPTION_DIR"/b_more_option_ic_add_to_spam.png"
@@ -52,6 +52,7 @@
 #define THUMB_CONTACT_IMG_PATH           IMAGE_PATH"/messages_list_thumb_image_single.png"
 #define THUMB_GROUP_IMG_PATH             IMAGE_PATH"/messages_list_thumb_image_multi.png"
 
+
 // Edj:
 #define ICONS_EDJ_PATH                   EDJ_PATH"/icons.edj"
 #define IMAGES_EDJ_PATH                  EDJ_PATH"/images.edj"
@@ -67,5 +68,6 @@
 #define SEARCH_BAR_EDJ_PATH              EDJ_PATH"/search_bar.edj"
 #define CONV_GENLIST_THEME_EDJ_PATH      EDJ_PATH"/conv_genlist_theme.edj"
 #define INPUT_LAYOUT_EDJ_PATH            EDJ_PATH"/input_layout.edj"
+#define CONV_LIST_BUBBLE_EDJ_PATH        EDJ_PATH"/conv_list_bubble.edj"
 
 #endif /* RESOURCE_H_ */
index d72369c332a2ae8bd23b7f88086b339fb82d65d9..177be3ba7f8652b1ef4eb2b0cc59d89781620271 100644 (file)
@@ -4,9 +4,7 @@
 #define ENTRY_BUBBLE_TEXT_SIZE               20
 #define DATELINE_TEXT_SIZE                   24
 #define REPLY_TEXT_SIZE                      24
-#define MAIN_TEXT_SIZE                       28
 
-#define BUBBLE_CONTENT_WIDTH_MAX             240
 #define BUBBLE_CONTENT_WIDTH_MIN             78
 #define BUBBLE_CONTENT_HEIGHT_MIN            37
 
@@ -72,16 +70,6 @@ collections {
          base: "font=Tizen:weight=Normal:width=Condensed font_size="REPLY_TEXT_SIZE" text_class=tizen color=#fafafa align=center";
          tag:  "match" "+ color=#006EFF";
       }
-      style {
-         name: "textblock_style";
-         base: "font=Tizen:weight=Normal:width=Condensed font_size="MAIN_TEXT_SIZE" color=#000 wrap=mixed text_class=tizen align=left";
-         tag:  "match" "+ color=#006EFF";
-      }
-      style {
-         name: "mms_attachment_text_style";
-         base: "font=Tizen:weight=Normal:width=Condensed font_size="20" text_class=tizen wrap=mixed color=#000 align=left";
-         tag:  "match" "+ color=#006EFF";
-      }
    }
 
    group { name: "elm/genlist/item/sentbubble/default";
@@ -677,126 +665,4 @@ collections {
          }
       }
    }
-   group { name: "conv/list/1icon_1text";
-      parts {
-         spacer { "padding.left"; scale;
-            desc { "default";
-               min: 3 0;
-               max: 3 -1;
-               align: 0.0 0.5;
-               rel1.to_x: "icon";
-               rel1.relative: 1.0 0.0;
-               rel2.relative: 1.0 1.0;
-            }
-         }
-         PADDING_TOP("padding.top", 3);
-         textblock { "main.text"; scale;
-            desc { "default";
-               align: 0 0;
-               rel1.to_x : "padding.left";
-               rel1.to_y: "padding.top";
-               rel1.relative: 1.0 1.0;
-               min: 204 26;
-               max: 204 -1;
-               text {
-                  style: "mms_attachment_text_style";
-                  min: 1 1;
-                  align: 0.0 0;
-                  ellipsis: -1;
-               }
-            }
-         }
-         swallow { "icon"; scale;
-            desc { "default";
-               min: 33 32;
-               max: 33 32;
-               align: 0.0 0.0;
-               rel1.relative: 0.0 0.0;
-               rel2.relative: 1.0 1.0;
-            }
-         }
-      }
-   }
-   group { name: "elm/label/base/conv_bubble";
-      parts {
-         rect { "label.text.clip"; scale;
-            desc { "default";}
-         }
-         textblock { "elm.text"; scale;
-            clip_to: "label.text.clip";
-            desc { "default";
-               text {
-                  style: "textblock_style";
-                  min: 0 1;
-                  align: 0.0 0.0;
-               }
-            }
-         }
-      }
-   }
-   group { name: "conv/list/bubble_item_bg";
-      parts {
-         spacer { "bg"; scale;
-            desc { "default";
-            }
-            desc { "pressed";
-               inherit: "default";
-            }
-         }
-         swallow { "content"; scale;
-            desc { "default";
-            }
-         }
-         swallow { "swl.gesture"; scale;
-            repeat_events: 1;
-            desc { "default";
-               rel.to: "bg";
-            }
-         }
-      }
-      programs {
-         program { name: "pressed";
-            signal: "mouse,down,1";
-            source: "content";
-            action: STATE_SET "pressed" 0.0;
-            transition: LINEAR  0.1;
-            target: "bg";
-         }
-         program { name: "unpressed";
-            signal: "mouse,up,1";
-            source: "content";
-            action: STATE_SET "default" 0.0;
-            transition: LINEAR  0.1;
-            target: "bg";
-         }
-      }
-   }
-   group { "conv/list/bubble_subject_item";
-      parts {
-         swallow { "text.swl"; scale;
-            desc { "default";
-               align: 0 0;
-            }
-         }
-         spacer { "pad.bottom"; scale;
-            desc { "default";
-               min: 0 6;
-               max: -1 6;
-               rel1.to_y: "text.swl";
-               rel1.relative: 0 1;
-               align: 0 0;
-            }
-         }
-         rect { "divider"; scale;
-            desc { "default";
-               min: 240 1;
-               max: 240 1;
-               rel1.to_y: "pad.bottom";
-               rel1.relative: 0 1;
-               align: 0 0;
-               color: 0 0 0 68;
-            }
-         }
-      }
-   }
 }
diff --git a/res/edje/conv_list_bubble.edc b/res/edje/conv_list_bubble.edc
new file mode 100644 (file)
index 0000000..af76602
--- /dev/null
@@ -0,0 +1,218 @@
+
+#include "macros.inl"
+#include "colors_define.inl"
+
+#define MAIN_TEXT_SIZE                       28
+#define ATTACHMENTS_TEXT_SIZE                20
+
+#define MAX_CONTENT_WIDTH                    240
+#define PLAY_BUTTON_SIZE                     110
+
+collections {
+
+   BASE_SCALE;
+
+   plugins {
+      TOUCH_SOUND_PLUGIN;
+   }
+
+   images {
+      image: "thread_view_msg_att_video_play.png" RAW;
+      image: "thread_view_msg_att_video_play_ef.png" RAW;
+   }
+
+   styles {
+      style {
+         name: "textblock_style";
+         base: "font=Tizen:weight=Normal:width=Condensed font_size="MAIN_TEXT_SIZE" color=#000 wrap=mixed text_class=tizen align=left";
+         tag:  "match" "+ color=#006EFF";
+      }
+      style {
+         name: "mms_attachment_text_style";
+         base: "font=Tizen:weight=Normal:width=Condensed font_size="ATTACHMENTS_TEXT_SIZE" text_class=tizen wrap=mixed color=#000 align=left";
+         tag:  "match" "+ color=#006EFF";
+      }
+   }
+   group { name: "conv/list/1icon_1text";
+      parts {
+         spacer { "padding.left"; scale;
+            desc { "default";
+               min: 3 0;
+               max: 3 -1;
+               align: 0.0 0.5;
+               rel1.to_x: "icon";
+               rel1.relative: 1.0 0.0;
+               rel2.relative: 1.0 1.0;
+            }
+         }
+         PADDING_TOP("padding.top", 3);
+         textblock { "main.text"; scale;
+            desc { "default";
+               align: 0 0;
+               rel1.to_x : "padding.left";
+               rel1.to_y: "padding.top";
+               rel1.relative: 1.0 1.0;
+               min: 204 26;
+               max: 204 -1;
+               text {
+                  style: "mms_attachment_text_style";
+                  min: 1 1;
+                  align: 0.0 0;
+                  ellipsis: -1;
+               }
+            }
+         }
+         swallow { "icon"; scale;
+            desc { "default";
+               min: 33 32;
+               max: 33 32;
+               align: 0.0 0.0;
+               rel1.relative: 0.0 0.0;
+               rel2.relative: 1.0 1.0;
+            }
+         }
+      }
+   }
+   group { name: "elm/label/base/conv_bubble";
+      parts {
+         rect { "label.text.clip"; scale;
+            desc { "default";}
+         }
+         textblock { "elm.text"; scale;
+            clip_to: "label.text.clip";
+            desc { "default";
+               text {
+                  style: "textblock_style";
+                  min: 0 1;
+                  align: 0.0 0.0;
+               }
+            }
+         }
+      }
+   }
+   group { name: "conv/list/bubble_item_bg";
+      parts {
+         spacer { "bg"; scale;
+            desc { "default";
+            }
+            desc { "pressed";
+               inherit: "default";
+            }
+         }
+         swallow { "content"; scale;
+            desc { "default";
+            }
+         }
+         swallow { "swl.gesture"; scale;
+            repeat_events: 1;
+            desc { "default";
+               rel.to: "bg";
+            }
+         }
+      }
+      programs {
+         program { name: "pressed";
+            signal: "mouse,down,1";
+            source: "content";
+            action: STATE_SET "pressed" 0.0;
+            transition: LINEAR  0.1;
+            target: "bg";
+         }
+         program { name: "unpressed";
+            signal: "mouse,up,1";
+            source: "content";
+            action: STATE_SET "default" 0.0;
+            transition: LINEAR  0.1;
+            target: "bg";
+         }
+      }
+   }
+   group { "conv/list/bubble_subject_item";
+      parts {
+         swallow { "text.swl"; scale;
+            desc { "default";
+               align: 0 0;
+            }
+         }
+         spacer { "pad.bottom"; scale;
+            desc { "default";
+               min: 0 6;
+               max: -1 6;
+               rel1.to_y: "text.swl";
+               rel1.relative: 0 1;
+               align: 0 0;
+            }
+         }
+         rect { "divider"; scale;
+            desc { "default";
+               min: MAX_CONTENT_WIDTH 1;
+               max: MAX_CONTENT_WIDTH 1;
+               rel1.to_y: "pad.bottom";
+               rel1.relative: 0 1;
+               align: 0 0;
+               color: 0 0 0 68;
+            }
+         }
+      }
+   }
+   group {
+      name: "conv/list/video_item";
+      images {
+         image: "thread_view_msg_att_video_play.png" COMP;
+         image: "thread_view_msg_att_video_play_ef.png" COMP;
+      }
+      parts {
+         swallow { "content"; scale;
+            desc { "default";
+            }
+         }
+         image { "play_button_ef"; scale;
+            repeat_events: 1;
+            desc { "default";
+               image.normal: "thread_view_msg_att_video_play_ef.png";
+               min: PLAY_BUTTON_SIZE PLAY_BUTTON_SIZE;
+               max: PLAY_BUTTON_SIZE PLAY_BUTTON_SIZE;
+               color: 0 0 0 26;
+               rel.to: "content";
+            }
+            desc { "pressed";
+               inherit: "default";
+               color: 0 0 0 13;
+            }
+         }
+         image { "play_button"; scale;
+            repeat_events: 1;
+            desc { "default";
+               image.normal: "thread_view_msg_att_video_play.png";
+               min: PLAY_BUTTON_SIZE PLAY_BUTTON_SIZE;
+               max: PLAY_BUTTON_SIZE PLAY_BUTTON_SIZE;
+               rel.to: "play_button_ef";
+               color: 250 250 250 255;
+            }
+            desc { "pressed";
+               inherit: "default";
+               color: 250 250 250 102;
+            }
+         }
+      }
+      programs {
+         program { name: "pressed";
+            signal: "mouse,down,1";
+            source: "play_button";
+            action: STATE_SET "pressed" 0.0;
+            transition: LINEAR  0.1;
+            target: "play_button";
+            target: "play_button_ef";
+         }
+         program { name: "unpressed";
+            signal: "mouse,up,1";
+            source: "play_button";
+            action: STATE_SET "default" 0.0;
+            transition: LINEAR  0.1;
+            target: "play_button";
+            target: "play_button_ef";
+         }
+      }
+   }
+}
+
diff --git a/res/images/cat.png b/res/images/cat.png
new file mode 100644 (file)
index 0000000..c3e20aa
Binary files /dev/null and b/res/images/cat.png differ
diff --git a/src/Conversation/Controller/inc/BubbleImageEntity.h b/src/Conversation/Controller/inc/BubbleImageEntity.h
new file mode 100644 (file)
index 0000000..9bcfacd
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BubbleImageEntity_h_
+#define BubbleImageEntity_h_
+
+#include "BubbleImageViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg {
+    class BubbleImageEntity
+        : public BubbleEntity {
+        public:
+            BubbleImageEntity(const std::string &filePath, Message::Direction direction);
+            virtual ~BubbleImageEntity();
+
+            virtual BubbleImageViewItem *createView(Evas_Object *parent);
+    };
+
+
+    inline BubbleImageEntity::BubbleImageEntity(const std::string &filePath, Message::Direction direction)
+        : BubbleEntity(ImageItem, direction, filePath)
+    {
+    }
+
+    inline BubbleImageEntity::~BubbleImageEntity()
+    {
+    }
+
+    inline BubbleImageViewItem *BubbleImageEntity::createView(Evas_Object *parent)
+    {
+        auto *item = new BubbleImageViewItem(*this, parent, getFilePath());
+        return item;
+    }
+}
+
+#endif /* BubbleImageEntity_h_ */
diff --git a/src/Conversation/Controller/inc/BubbleVideoEntity.h b/src/Conversation/Controller/inc/BubbleVideoEntity.h
new file mode 100644 (file)
index 0000000..0de9a74
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BubbleVideoEntity_h_
+#define BubbleVideoEntity_h_
+
+#include "BubbleVideoViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg {
+    class BubbleVideoEntity
+        : public BubbleEntity {
+        public:
+            BubbleVideoEntity(const std::string &filePath, Message::Direction direction);
+            virtual ~BubbleVideoEntity();
+
+            virtual BubbleVideoViewItem *createView(Evas_Object *parent);
+
+        private:
+            std::string m_ImgPath;
+    };
+}
+
+#endif /* BubbleVideoEntity_h_ */
diff --git a/src/Conversation/Controller/src/BubbleVideoEntity.cpp b/src/Conversation/Controller/src/BubbleVideoEntity.cpp
new file mode 100644 (file)
index 0000000..b334041
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BubbleVideoEntity.h"
+#include "MediaUtils.h"
+#include "FileUtils.h"
+
+using namespace Msg;
+
+
+BubbleVideoEntity::BubbleVideoEntity(const std::string &filePath, Message::Direction direction)
+    : BubbleEntity(VideoItem, direction, filePath)
+{
+    // TODO: when video player will be available
+    m_ImgPath =  filePath;
+}
+
+BubbleVideoEntity::~BubbleVideoEntity()
+{
+}
+
+BubbleVideoViewItem *BubbleVideoEntity::createView(Evas_Object *parent)
+{
+    auto *item = new BubbleVideoViewItem(*this, parent, m_ImgPath);
+    return item;
+}
+
index 981b138d836cebabdb678c6d082e4b034eb53cd9..4d1432083f459f2875a7b11904b1e7d0e1fa6896 100644 (file)
@@ -24,6 +24,7 @@
 #include "ConvTitleListItem.h"
 #include "ConvDateLineListItem.h"
 #include "TimeUtils.h"
+#include "BubbleEntityFactory.h"
 
 using namespace Msg;
 
diff --git a/src/Conversation/View/inc/BubbleImageViewItem.h b/src/Conversation/View/inc/BubbleImageViewItem.h
new file mode 100644 (file)
index 0000000..2b4a0c9
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BubbleImageViewItem_h_
+#define BubbleImageViewItem_h_
+
+#include "BubbleViewItem.h"
+
+namespace Msg {
+    class BubbleImageViewItem
+        : public BubbleViewItem {
+        public:
+            BubbleImageViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath);
+            virtual ~BubbleImageViewItem();
+
+            static Evas_Object *createImage(Evas_Object *parent, const std::string &path);
+    };
+}
+
+#endif /* BubbleImageViewItem_h_ */
diff --git a/src/Conversation/View/inc/BubbleVideoViewItem.h b/src/Conversation/View/inc/BubbleVideoViewItem.h
new file mode 100644 (file)
index 0000000..f34b961
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BubbleVideoViewItem_h_
+#define BubbleVideoViewItem_h_
+
+#include "BubbleViewItem.h"
+#include "BubbleImageViewItem.h"
+
+namespace Msg {
+    class BubbleVideoViewItem
+        : public BubbleViewItem {
+        public:
+            BubbleVideoViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath);
+            virtual ~BubbleVideoViewItem();
+
+            void calculate() override;
+
+        private:
+            Evas_Object *m_pVideoLayout;
+    };
+
+
+    inline BubbleVideoViewItem::BubbleVideoViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath)
+        : BubbleViewItem(parent, entity)
+        , m_pVideoLayout(nullptr)
+    {
+        m_pVideoLayout = addLayout(parent, CONV_LIST_BUBBLE_EDJ_PATH, "conv/list/video_item");
+        Evas_Object *image = BubbleImageViewItem::createImage(m_pVideoLayout, imagePath);
+        View::setContent(m_pVideoLayout, image, "content");
+        setContent(m_pVideoLayout);
+        attachGestureTapLayer(m_pVideoLayout, image);
+    }
+
+    inline BubbleVideoViewItem::~BubbleVideoViewItem()
+    {
+    }
+
+    inline void BubbleVideoViewItem::calculate()
+    {
+        evas_object_smart_calculate(m_pVideoLayout);
+        BubbleViewItem::calculate();
+    }
+}
+
+#endif /* BubbleVideoViewItem_h_ */
index 701eebcab6080dd1a0a35eeef70fd1c58e8e74ee..76a372a8149e9d406adf150a383f863578a078dc 100644 (file)
@@ -25,7 +25,7 @@ BubbleIconTextLayoutItem::BubbleIconTextLayoutItem(Evas_Object *parent, BubbleEn
     : BubbleViewItem(parent, entity)
     , m_pIconTextLayout(nullptr)
 {
-    m_pIconTextLayout = addLayout(getEo(), CONV_GENLIST_THEME_EDJ_PATH, "conv/list/1icon_1text");
+    m_pIconTextLayout = addLayout(getEo(), CONV_LIST_BUBBLE_EDJ_PATH, "conv/list/1icon_1text");
     setContent(m_pIconTextLayout);
 }
 
diff --git a/src/Conversation/View/src/BubbleImageViewItem.cpp b/src/Conversation/View/src/BubbleImageViewItem.cpp
new file mode 100644 (file)
index 0000000..973c60f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BubbleImageViewItem.h"
+#include "Resource.h"
+#include "Logger.h"
+
+using namespace Msg;
+
+BubbleImageViewItem::BubbleImageViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath)
+    : BubbleViewItem(parent, entity)
+{
+    Evas_Object *img = createImage(parent, imagePath);
+    setContent(img);
+    attachGestureTapLayer(getEo(), img);
+}
+
+BubbleImageViewItem::~BubbleImageViewItem()
+{
+}
+
+Evas_Object *BubbleImageViewItem::createImage(Evas_Object *parent, const std::string &path)
+{
+    int imageWidth = 0;
+    int imageHeight = 0;
+
+    Evas_Object *image = elm_image_add(parent);
+    elm_image_preload_disabled_set(image, true);
+    elm_image_prescale_set(image, maxWidth);
+    elm_image_aspect_fixed_set(image, true);
+    elm_image_file_set(image, path.c_str(), nullptr);
+    elm_image_object_size_get(image, &imageWidth, &imageHeight);
+
+    double scale = maxWidth / (double)imageWidth;
+    imageWidth *= scale;
+    imageHeight *= scale;
+
+    evas_object_size_hint_min_set(image, imageWidth, imageHeight);
+    evas_object_size_hint_align_set(image, 1.0, EVAS_HINT_FILL);
+    evas_object_show(image);
+    return image;
+}
index 32fce86cfbc4acd531c71a3bfa1bf6f7047c0f04..58f5302362163a1228d85d87967653f9180cabf7 100644 (file)
 #include "BubbleTextViewItem.h"
 #include "Resource.h"
 #include "Logger.h"
+#include "TextDecorator.h"
 
 using namespace Msg;
 
+const std::string textColor = "#000";
+
 BubbleSubjectViewItem::BubbleSubjectViewItem(BubbleEntity &entity, Evas_Object *parent)
     : BubbleViewItem(parent, entity)
     , m_pTextLayout(nullptr)
 {
-    m_pTextLayout = addLayout(getEo(), CONV_GENLIST_THEME_EDJ_PATH, "conv/list/bubble_subject_item");
+    m_pTextLayout = addLayout(getEo(), CONV_LIST_BUBBLE_EDJ_PATH, "conv/list/bubble_subject_item");
     setContent(m_pTextLayout);
 }
 
@@ -35,7 +38,7 @@ BubbleSubjectViewItem::~BubbleSubjectViewItem()
 
 void BubbleSubjectViewItem::setText(const std::string &text)
 {
-    View::setContent(m_pTextLayout, BubbleTextViewItem::createText(m_pTextLayout, text), "text.swl");
+    View::setContent(m_pTextLayout, BubbleTextViewItem::createText(m_pTextLayout, TextDecorator::make(text, textColor)), "text.swl");
 }
 
 void BubbleSubjectViewItem::calculate()
index 403b578b236e5872b3b4ec3b347348258fb7f1ec..dbf25caa2f15ba39d07de8b4209fd0798c68469d 100644 (file)
@@ -24,7 +24,7 @@ BubbleViewItem::BubbleViewItem(Evas_Object *parent, BubbleEntity &entity)
     : m_Entity(entity)
     , m_pListener(nullptr)
 {
-    setEo(addLayout(parent, CONV_GENLIST_THEME_EDJ_PATH, "conv/list/bubble_item_bg"));
+    setEo(addLayout(parent, CONV_LIST_BUBBLE_EDJ_PATH, "conv/list/bubble_item_bg"));
     View::setContent(createGestureRect(getEo()), "swl.gesture");
     evas_object_size_hint_align_set(getEo(), 1.0, EVAS_HINT_FILL);
 }