TizenRefApp-8225 Implement Audio bubble item for conversation 26/121726/6
authorOleksander Kostenko <o.kostenko@samsung.com>
Tue, 28 Mar 2017 13:47:26 +0000 (16:47 +0300)
committerOleksander Kostenko <o.kostenko@samsung.com>
Wed, 29 Mar 2017 10:35:59 +0000 (13:35 +0300)
Change-Id: I8f498d16d31c693a2d1699948a3b3b84b0ba92da
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
12 files changed:
res/edje/conv_list_bubble.edc
src/Conversation/Controller/inc/BubbleAudioEntity.h [new file with mode: 0644]
src/Conversation/Controller/inc/BubbleCalEventEntity.h
src/Conversation/Controller/inc/BubbleEntity.h
src/Conversation/Controller/inc/BubbleSubjectEntity.h
src/Conversation/Controller/inc/BubbleVoiceEntity.h [new file with mode: 0644]
src/Conversation/Controller/src/BubbleCalEventEntity.cpp
src/Conversation/Controller/src/BubbleContactEntity.cpp
src/Conversation/Controller/src/BubbleSubjectEntity.cpp
src/Conversation/Controller/src/BubbleVideoEntity.cpp
src/Conversation/View/inc/BubbleVoiceViewItem.h [new file with mode: 0644]
src/Conversation/View/src/BubbleVoiceViewItem.cpp [new file with mode: 0644]

index af7660225d47e34ba7b46d1fae67cebd2e99072a..adec36dcf6d079c54d39855172b2c2d1366197bf 100644 (file)
@@ -32,6 +32,10 @@ collections {
          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";
       }
+      style {
+         name: "style_bubble_content_sound_filename";
+         base: "font=Tizen:style=Regular font_size="20" color=#000 text_class=tizen align=left ellipsis=0.5";
+      }
    }
    group { name: "conv/list/1icon_1text";
       parts {
@@ -214,5 +218,232 @@ collections {
          }
       }
    }
+   group {
+      name: "conv/list/voice_item";
+      images {
+         image: "msg_received.#.png" COMP;
+         image: "msg_received_play.png" COMP;
+         image: "msg_received_pause.png" COMP;
+      }
+      parts {
+         part {
+            name: "progress.bg";
+            type: IMAGE;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               color_class: "AO052L1";
+               fixed: 0 1;
+               align: 0.5 0.5;
+               image.normal: "msg_received.#.png";
+            }
+         }
+         part {
+            name: "padding_top";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {relative: 0.0 0.0;}
+               rel2 {relative: 1.0 0.0;}
+               align: 0.0 0.0;
+               min: 0 8;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "padding_bottom";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {relative: 0.0 1.0;}
+               rel2 {relative: 1.0 1.0;}
+               align: 0.0 1.0;
+               min: 0 7;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "padding_left";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {relative: 0.0 0.0;}
+               rel2 {relative: 0.0 1.0;}
+               align: 0.0 0.0;
+               min: 10 0;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "padding_right";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {relative: 1.0 0.0;}
+               rel2 {
+                  relative: 1.0 1.0;
+                  to: "progress.bg";
+               }
+               align: 1.0 1.0;
+               min: 15 0;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "progress.step";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               fixed: 0 1;
+               min: 0 63;
+               align: 0.0 0.0;
+               rel1 {to: "progress.bg"; relative: 0.0 0.0; }
+               rel2 {to_x: "progress.circle"; to_y: "progress.bg"; relative: 0.5 1.0;}
+               image.normal: "msg_received.#.png";
+               color: 153 228 255 255;
+            }
+         }
+         part {
+            name: "progress.confine.rect";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               visible: 1;
+               rel1 {to: "progress.bg"; relative: 0.0 0.0; }
+               rel2 {to: "progress.bg"; relative: 1.0 1.0; }
+               color: 255 255 255 0;
+            }
+         }
+         part {
+            name: "progress.circle";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               visible: 0;
+               min: 14 63;
+               fixed: 1 1;
+               align: 0.5 0.5;
+               rel1 {to_x: "rect.progress"; to_y: "progress.bg"; relative: 0.5 0.5;}
+               rel2 {to_x: "rect.progress"; to_y: "progress.bg"; relative: 0.5 0.5;}
+               color: 255 255 255 255;
+            }
+         }
+         part {
+            name: "rect.progress";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               visible: 0;
+               min: 0 63;
+               fixed: 0 1;
+               align: 0.0 0.0;
+               rel1 {to: "progress.bg"; relative: 0.0 0.0; }
+               rel2 {to: "progress.bg"; relative: 0.0 1.0; }
+            }
+            dragable {
+               confine: "progress.confine.rect";
+               x: 1 1 1;
+            }
+         }
+         part {
+            name: "icon";
+            type: IMAGE;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {to_x: "padding_left"; to_y: "padding_top"; relative: 1.0 1.0;}
+               rel2 {to_x: "padding_left"; to_y: "padding_bottom"; relative: 0.0 0.0;}
+               fixed: 1 1;
+               align: 0.0 0.5;
+               min: 40 40;
+               max: 40 40;
+               image.normal: "msg_received_play.png";
+               color: 0 0 0 255;
+            }
+            description {
+               state: "play" 0.0;
+               inherit: "default" 0.0;
+               image.normal: "msg_received_pause.png";
+            }
+         }
+         part {
+            name: "padding_icon";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 { to_x: "icon"; relative: 1.0 0.0;}
+               rel2 { to_x: "icon"; relative: 1.0 1.0;}
+               align: 0.0 0.0;
+               min: 9 0;
+               max: 9 0;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "text.filename";
+            type: TEXTBLOCK;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {to_x: "padding_icon"; to_y: "padding_top"; relative: 1.0 1.0;}
+               rel2 {to_x: "padding_right"; to_y: "padding_top"; relative: 0.0 1.0;}
+               align: 0.0 0.0;
+               min: 166 24;
+               max: 166 24;
+               fixed: 0 1;
+               color: 0 0 0 153;
+               text {
+                  min: 1 1;
+                  ellipsis: -1;
+                  style: "style_bubble_content_sound_filename";
+               }
+            }
+         }
+         part {
+            name: "text.time";
+            type: TEXTBLOCK;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1 {to_x: "padding_icon"; to_y: "text.filename"; relative: 1.0 1.0;}
+               rel2 {to_x: "padding_right"; to_y: "padding_bottom"; relative: 0.0 0.0;}
+               min: 166 24;
+               max: 166 24;
+               align: 0.0 0.0;
+               color: 0 0 0 153;
+               text {
+                  style: "style_bubble_content_sound_filename";
+                  align: 0.0 0.5;
+               }
+            }
+         }
+      }
+      programs {
+         program {
+            name: "play";
+            signal: "sound,play";
+            source: "";
+            action: STATE_SET "play" 0.0;
+            target: "icon";
+         }
+         program {
+            name: "pause";
+            signal: "sound,pause";
+            source: "";
+            action: STATE_SET "default" 0.0;
+            target: "icon";
+         }
+      }
+   }
 }
 
diff --git a/src/Conversation/Controller/inc/BubbleAudioEntity.h b/src/Conversation/Controller/inc/BubbleAudioEntity.h
new file mode 100644 (file)
index 0000000..f992953
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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 BubbleAudioEntity_h_
+#define BubbleAudioEntity_h_
+
+#include "BubbleEntity.h"
+#include "BubbleIconTextLayoutItem.h"
+
+namespace Msg {
+    class BubbleAudioEntity
+        : public BubbleEntity {
+        public:
+            BubbleAudioEntity(const std::string &filePath, const std::string fileName, Message::Direction direction);
+            virtual ~BubbleAudioEntity();
+
+            BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
+
+        private:
+            std::string m_FileName;
+    };
+    inline BubbleAudioEntity::BubbleAudioEntity(const std::string &filePath, const std::string fileName, Message::Direction direction)
+        : BubbleEntity(AudioItem, direction, filePath)
+        , m_FileName(std::move(fileName))
+    {
+    }
+
+    inline BubbleAudioEntity::~BubbleAudioEntity()
+    {
+    }
+
+    inline BubbleIconTextLayoutItem *BubbleAudioEntity::createView(Evas_Object *parent)
+    {
+        auto *item = new BubbleIconTextLayoutItem(parent, *this);
+        item->setIcon(item->createIcon(ATTACH_MUSIC_ICON));
+        item->setMainText(m_FileName);
+        return item;
+    }
+}
+
+#endif /* BubbleAudioEntity_h_ */
index 664075c6665a4aa4f8bd3dda74d68a9bc2a984de..35df900a6132a6a4f1f7f86b088089c3165af6cc 100644 (file)
@@ -24,7 +24,7 @@ namespace Msg {
     class BubbleCalEventEntity
         : public BubbleEntity {
         public:
-            BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
+            BubbleCalEventEntity(const std::string &filePath, const std::string fileName, Message::Direction direction);
             virtual ~BubbleCalEventEntity();
 
             BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
index 566dab2cdc1e77c690a448d7542e3d3132c2869b..ea66ce1320976fe5549384c67d0a562e02a3cd26 100644 (file)
@@ -36,6 +36,7 @@ namespace Msg {
                 SubjectItem,
                 TextItem,
                 ImageItem,
+                VoiceItem,
                 AudioItem,
                 VideoItem,
                 ContactItem,
index bc684ce492c2a1814a1513a8789c1da636e1721a..bdef5f82e4c143685d91afb3e9a83db385ed59ca 100644 (file)
@@ -24,7 +24,7 @@ namespace Msg {
     class BubbleSubjectEntity
         : public BubbleEntity {
         public:
-            BubbleSubjectEntity(const std::string &subject, Message::Direction direction);
+            BubbleSubjectEntity(const std::string subject, Message::Direction direction);
             virtual ~BubbleSubjectEntity();
 
             BubbleSubjectViewItem *createView(Evas_Object *parent) override;
diff --git a/src/Conversation/Controller/inc/BubbleVoiceEntity.h b/src/Conversation/Controller/inc/BubbleVoiceEntity.h
new file mode 100644 (file)
index 0000000..8ac757d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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 BubbleVoiceEntity_h_
+#define BubbleVoiceEntity_h_
+
+#include "BubbleEntity.h"
+#include "BubbleVoiceViewItem.h"
+
+namespace Msg {
+    class BubbleVoiceEntity
+        : public BubbleEntity {
+        public:
+            BubbleVoiceEntity(const std::string &filePath, const std::string fileName, Message::Direction direction);
+            virtual ~BubbleVoiceEntity();
+
+            BubbleVoiceViewItem *createView(Evas_Object *parent) override;
+
+        private:
+            std::string m_FileName;
+    };
+    inline BubbleVoiceEntity::BubbleVoiceEntity(const std::string &filePath, const std::string fileName, Message::Direction direction)
+        : BubbleEntity(VoiceItem, direction, filePath)
+        , m_FileName(std::move(fileName))
+    {
+    }
+
+    inline BubbleVoiceEntity::~BubbleVoiceEntity()
+    {
+    }
+
+    inline BubbleVoiceViewItem *BubbleVoiceEntity::createView(Evas_Object *parent)
+    {
+        auto *item = new BubbleVoiceViewItem(parent, *this);
+        return item;
+    }
+}
+
+#endif /* BubbleVoiceEntity_h_ */
index fa0d2ac6ecf102442241df268d9ce156797eee5b..acb72860167bb0f5bf200b460e893da655a1033f 100644 (file)
 
 using namespace Msg;
 
-BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
+BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string fileName, Message::Direction direction)
     : BubbleEntity(CalendarEventItem, direction, filePath)
+    , m_Name(std::move(fileName))
 {
-    m_Name = fileName;
 }
 
 BubbleCalEventEntity::~BubbleCalEventEntity()
index 999e9088e86fd9010ce276b216c7638669bff222..2a0a58d94e3e83672e1cb34282dea71d6cc5969f 100644 (file)
@@ -22,8 +22,8 @@ using namespace Msg;
 
 BubbleContactEntity::BubbleContactEntity(const std::string &filePath, std::string fileName, Message::Direction direction)
     : BubbleEntity(ContactItem, direction, filePath)
+    , m_Name(std::move(fileName))
 {
-    m_Name = std::move(fileName);
 }
 
 BubbleContactEntity::~BubbleContactEntity()
index 5010d796e0f2d2c7681f8b41ae5027f25a26b3e4..8a8e35b60399db919cd6ecc4ae284acc288668fc 100644 (file)
@@ -19,9 +19,9 @@
 
 using namespace Msg;
 
-BubbleSubjectEntity::BubbleSubjectEntity(const std::string &subject, Message::Direction direction)
+BubbleSubjectEntity::BubbleSubjectEntity(const std::string subject, Message::Direction direction)
     : BubbleEntity(SubjectItem, direction)
-    , m_Subject(subject)
+    , m_Subject(std::move(subject))
 {
 }
 
index 770aa774315bd3edf43763847f4f8c676b7abf78..5469de7352b90c23738d31753323bd8895529e4c 100644 (file)
@@ -25,7 +25,6 @@ BubbleVideoEntity::BubbleVideoEntity(WorkingDirRef workingDir, const std::string
     , m_WorkingDir(workingDir)
 {
     // TODO: when video player will be available
-    m_ImgPath =  filePath;
 }
 
 BubbleVideoEntity::~BubbleVideoEntity()
@@ -34,7 +33,7 @@ BubbleVideoEntity::~BubbleVideoEntity()
 
 BubbleVideoViewItem *BubbleVideoEntity::createView(Evas_Object *parent)
 {
-    auto *item = new BubbleVideoViewItem(*this, parent, m_ImgPath);
+    auto *item = new BubbleVideoViewItem(*this, parent, getFilePath());
     return item;
 }
 
diff --git a/src/Conversation/View/inc/BubbleVoiceViewItem.h b/src/Conversation/View/inc/BubbleVoiceViewItem.h
new file mode 100644 (file)
index 0000000..a54f817
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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 BubbleVoiceViewItem_h_
+#define BubbleVoiceViewItem_h_
+
+#include "BubbleViewItem.h"
+
+namespace Msg {
+    class BubbleVoiceViewItem
+        : public BubbleViewItem {
+        public:
+            BubbleVoiceViewItem(Evas_Object *parent, BubbleEntity &entity);
+            virtual ~BubbleVoiceViewItem();
+
+            void setMainText(const std::string &text);
+            void setTimeText(const std::string &text);
+            void setProgress(const double progress);
+            void calculate() override;
+
+        private:
+            Evas_Object *m_pVoiceItemLayout;
+    };
+}
+
+#endif /* BubbleVoiceViewItem_h_ */
diff --git a/src/Conversation/View/src/BubbleVoiceViewItem.cpp b/src/Conversation/View/src/BubbleVoiceViewItem.cpp
new file mode 100644 (file)
index 0000000..e69e60b
--- /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 "BubbleVoiceViewItem.h"
+#include "Resource.h"
+#include "TextDecorator.h"
+#include "PathUtils.h"
+
+using namespace Msg;
+
+BubbleVoiceViewItem::BubbleVoiceViewItem(Evas_Object *parent, BubbleEntity &entity)
+    : BubbleViewItem(parent, entity)
+    , m_pVoiceItemLayout(nullptr)
+{
+    m_pVoiceItemLayout = addLayout(getEo(), CONV_LIST_BUBBLE_EDJ_PATH, "conv/list/voice_item");
+    setContent(m_pVoiceItemLayout);
+}
+
+BubbleVoiceViewItem::~BubbleVoiceViewItem()
+{
+}
+
+void BubbleVoiceViewItem::setMainText(const std::string &text)
+{
+    elm_object_part_text_set(m_pVoiceItemLayout, "text.filename", text.c_str());
+}
+
+void BubbleVoiceViewItem::setTimeText(const std::string &text)
+{
+    elm_object_part_text_set(m_pVoiceItemLayout, "text.time", text.c_str());
+}
+
+void BubbleVoiceViewItem::setProgress(const double progress)
+{
+    edje_object_part_drag_value_set(elm_layout_edje_get(m_pVoiceItemLayout), "rect.progress", progress, 0.0);
+}
+
+void BubbleVoiceViewItem::calculate()
+{
+    evas_object_smart_calculate(m_pVoiceItemLayout);
+    BubbleViewItem::calculate();
+}