#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
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=label align=left";
+ tag: "match" "+ color=#006EFF";
+ }
}
group { name: "elm/genlist/item/sentbubble/default";
max: REPLY_SWALLOW_SIZE REPLY_SWALLOW_SIZE;
rel1.to_y: "padding.top";
rel1.relative: 0 1;
- rel2.to_y: "padding.top";
- rel2.relative: 1 1;
+ rel2.to_y: "reply.padding.bottom";
+ rel2.relative: 1 0;
align: 0.5 0;
fixed: 1 1;
}
align: 0.5 0;
min: 0 36;
max: -1 36;
- fixed: 0 1;
text.style: "reply_textblock_style";
text.max: 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 { "swl.gesture"; scale;
+ repeat_events: 1;
+ desc { "default";
+ rel.to: "bg";
+ }
+ }
+ swallow { "content"; scale;
+ desc { "default";
+ rel.to "swl.gesture";
+ }
+ }
+ }
+ 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";
+ }
+ }
+ }
}
--- /dev/null
+/*
+ * 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 BubbleTextEntity_h_
+#define BubbleTextEntity_h_
+
+#include "BubbleTextViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg {
+ class BubbleTextEntity
+ : public BubbleEntity {
+ public:
+ BubbleTextEntity(Message::Direction direction, std::string text);
+ virtual ~BubbleTextEntity();
+
+ virtual BubbleTextViewItem *createView(Evas_Object *parent);
+
+ private:
+ std::string m_Text;
+ };
+
+ inline BubbleTextEntity::BubbleTextEntity(Message::Direction direction, std::string text)
+ : BubbleEntity(TextItem, direction)
+ , m_Text(std::move(text))
+ {
+ }
+
+ inline BubbleTextEntity::~BubbleTextEntity()
+ {
+ }
+
+ inline BubbleTextViewItem *BubbleTextEntity::createView(Evas_Object *parent)
+ {
+ auto *item = new BubbleTextViewItem(*this, parent, m_Text);
+ return item;
+ }
+}
+
+#endif /* BubbleTextEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleTextViewItem_h_
+#define BubbleTextViewItem_h_
+
+#include "BubbleViewItem.h"
+
+namespace Msg {
+ class BubbleTextViewItem
+ : public BubbleViewItem {
+ public:
+ BubbleTextViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &text);
+ virtual ~BubbleTextViewItem();
+
+ private:
+ Evas_Object *createText(Evas_Object *parent, const std::string &text);
+ };
+}
+
+#endif /* BubbleTextViewItem_h_ */
public:
static const int maxWidth = 240;
- BubbleViewItem(BubbleEntity &entity);
+ BubbleViewItem(Evas_Object *parent, BubbleEntity &entity);
virtual ~BubbleViewItem();
virtual void calculate();
void setListener(IBubbleViewItemListener *l);
BubbleEntity &getEntity();
+ void setContent(Evas_Object *obj);
+ Evas_Object *getContent() const;
+
protected:
void emitActionEvent();
void attachGestureTapLayer(Evas_Object *parent, Evas_Object *obj);
+ private:
+ Evas_Object *createGestureRect(Evas_Object *parent);
+
private:
BubbleEntity &m_Entity;
IBubbleViewItemListener *m_pListener;
--- /dev/null
+/*
+ * 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 "BubbleTextViewItem.h"
+#include "Resource.h"
+#include "Logger.h"
+#include "TextDecorator.h"
+
+using namespace Msg;
+
+const std::string textColor = "#000";
+
+BubbleTextViewItem::BubbleTextViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &text)
+ : BubbleViewItem(parent, entity)
+{
+ setContent(createText(*this, TextDecorator::make(text, textColor)));
+}
+
+BubbleTextViewItem::~BubbleTextViewItem()
+{
+}
+
+Evas_Object *BubbleTextViewItem::createText(Evas_Object *parent, const std::string &text)
+{
+ if (text.empty())
+ return nullptr;
+
+ Evas_Object *label = elm_label_add(parent);
+ elm_object_style_set(label, "conv_bubble");
+
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_part_text_set(label, nullptr, text.c_str());
+ evas_object_show(label);
+
+ Evas_Object *edjeLabel = elm_layout_edje_get(label);
+ const Evas_Object *textBlock = edje_object_part_object_get(edjeLabel, "elm.text");
+
+ Evas_Coord ww = 0;
+ Evas_Coord hh = 0;
+
+ evas_object_textblock_size_native_get(textBlock, &ww, &hh);
+ int wrapWidth = ww > maxWidth ? maxWidth : ww;
+ elm_label_wrap_width_set(label, wrapWidth);
+
+ return label;
+}
using namespace Msg;
-BubbleViewItem::BubbleViewItem(BubbleEntity &entity)
+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"));
+ View::setContent(createGestureRect(getEo()), "swl.gesture");
+ evas_object_size_hint_align_set(getEo(), 1.0, EVAS_HINT_FILL);
}
BubbleViewItem::~BubbleViewItem()
return m_Entity;
}
+void BubbleViewItem::setContent(Evas_Object *obj)
+{
+ View::setContent(obj, "content");
+}
+
+Evas_Object *BubbleViewItem::getContent() const
+{
+ return View::getContent("content");
+}
+
void BubbleViewItem::attachGestureTapLayer(Evas_Object *parent, Evas_Object *obj)
{
const int tapFingerSize = 12;
this);
}
+Evas_Object *BubbleViewItem::createGestureRect(Evas_Object *parent)
+{
+ Evas *e = evas_object_rectangle_add(evas_object_evas_get(parent));
+ Evas_Object *rect = evas_object_rectangle_add(e);
+ evas_object_color_set(rect, 0, 0, 0, 0);
+ attachGestureTapLayer(parent, rect);
+ return rect;
+}
+
void BubbleViewItem::calculate()
{
evas_object_smart_calculate(getEo());