#define DEFAULT_LAYOUT_EDJ_PATH EDJ_PATH"/default_layout.edj"
#define RECIP_LAYOUT_EDJ_PATH EDJ_PATH"/recip_layout.edj"
#define RECIP_ENTRY_EDJ_PATH EDJ_PATH"/recip_entry.edj"
+#define COMPOSER_LAYOUT_EDJ_PATH EDJ_PATH"/composer_layout.edj"
+#define MSG_BODY_EDJ_PATH EDJ_PATH"/msg_body.edj"
#endif /* RESOURCE_H_ */
--- /dev/null
+#include "macros.inl"
+
+collections {
+ BASE_SCALE;
+ group { name: "main";
+ parts {
+ PADDING_TOP("pad.top", 100);
+ PADDING_BOTTOM("pad.bottom", 100);
+ part {
+ name: "swl.body";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default";
+ min: 318 0;
+ max: 318 -1;
+ fixed: 1 0;
+ rel1 { relative: 0.0 1.0; to_y: "pad.top"; }
+ rel2 { relative: 1.0 0.0; to_y: "pad.bottom"; }
+ }
+ }
+ }
+ }
+}
#include "macros.inl"
-#define BADGE_HEIGHT 32
-#define BADGE_MIN_WIDTH 32
-#define BADGE_MAX_WIDTH 60
-#define TEXT_SIZE 24
+#define PRESS_PROG(target_name, source_name) \
+ program { name: "pressed"; \
+ source: source_name; \
+ signal: "mouse,down,1"; \
+ action: STATE_SET "pressed" 0.0; \
+ target: target_name; \
+ transition: LINEAR 0.1; \
+ } \
+ program { name: "unpressed"; \
+ source: source_name; \
+ signal: "mouse,up,1"; \
+ action: STATE_SET "default" 0.0; \
+ target: target_name; \
+ transition: LINEAR 0.05; \
+ }
+
+#define DISABLED_PROG(targets) \
+ program { name: "disable"; \
+ signal: "elm,state,disabled"; \
+ source: "elm"; \
+ action: STATE_SET "disabled" 0.0; \
+ targets; \
+ } \
+ program { name: "enable"; \
+ signal: "elm,state,enabled"; \
+ source: "elm"; \
+ action: STATE_SET "default" 0.0; \
+ targets; \
+ }
collections {
BASE_SCALE;
}
}
programs {
- program { name: "pressed";
- source: "*";
- signal: "mouse,down,1";
- action: STATE_SET "pressed" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
- }
- program { name: "unpressed";
- source: "*";
- signal: "mouse,up,1";
- action: STATE_SET "default" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
- }
- program { name: "disable";
- signal: "elm,state,disabled";
- source: "elm";
- action: STATE_SET "disabled" 0.0;
- target: "bg";
- }
- program { name: "enable";
- signal: "elm,state,enabled";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "bg";
- }
+ PRESS_PROG("bg", "*");
+ DISABLED_PROG(target: "bg");
}
}
group {
- name: "compose_icon";
+ name: "thread/compose_icon";
images {
image: "msg_list_icon_composer.png" RAW; //change when icon will be added
image: "msg_list_icon_bg.png" RAW;
}
}
group {
- name: "contacts_icon";
+ name: "thread/contacts_icon";
images {
image: "msg_list_icon_recipients_bg.png" RAW; //change when icon will be added
image: "msg_list_icon_bg.png" RAW;
description {
state: "default" 0.0;
fixed: 0 1;
- min: BADGE_MIN_WIDTH BADGE_HEIGHT;
- max: BADGE_MAX_WIDTH BADGE_HEIGHT;
+ min: 32 32;
+ max: 60 32;
image {
- normal:"list_noti_new_bg.#.png";
+ normal:"list_noti_new_bg.#.png";
}
color: 255 106 0 255;
}
color: 255 255 255 255;
text {
font: "Tizen:style=Regular";
- size: TEXT_SIZE;
+ size: 24;
ellipsis: 0.0;
align: 0.5 0.5;
min: 1 0;
}
}
group {
- name: "recip_del_icon";
+ name: "recip/del_icon";
images {
image: "msg_composer_icon_bg.png" RAW;
image: "msg_composer_icon_sender.png" RAW;
}
}
programs {
- program { name: "pressed";
- source: "*";
- signal: "mouse,down,1";
- action: STATE_SET "pressed" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
- }
- program { name: "unpressed";
- source: "*";
- signal: "mouse,up,1";
- action: STATE_SET "default" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
- }
+ PRESS_PROG("bg", "icon");
}
}
group {
- name: "recip_contact_icon";
+ name: "recip/contact_icon";
images {
image: "msg_composer_icon_bg.png" RAW;
image: "msg_composer_icon_recipients.png" RAW;
}
}
programs {
- program { name: "pressed";
- source: "*";
- signal: "mouse,down,1";
- action: STATE_SET "pressed" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
+ PRESS_PROG("bg", "icon");
+ }
+ }
+ group {
+ name: "msg_body/compose_icon";
+ images {
+ image: "msg_composer_createmsg.png" RAW;
+ }
+ parts {
+ part {
+ name: "icon";
+ type:IMAGE;
+ description {
+ state: "default" 0.0;
+ image.normal: "msg_composer_createmsg.png";
+ color: 250 250 250 255;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default";
+ color: 250 250 250 102;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default";
+ color: 250 250 250 102;
+ }
}
- program { name: "unpressed";
- source: "*";
- signal: "mouse,up,1";
- action: STATE_SET "default" 0.0;
- target: "bg";
- transition: LINEAR 0.1;
+ part { name: "event";
+ type: RECT;
+ description { state: "default" 0.0;
+ rel1.to: "icon";
+ rel2.to: "icon";
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
}
}
+ programs {
+ PRESS_PROG("icon", "icon");
+ DISABLED_PROG(target: "event"; target: "icon");
+ }
}
}
\ No newline at end of file
#define BASE_SCALE base_scale: 1.3;
+#define SCR_W 360;
+#define SCR_H 360;
#define PADDING_LEFT(param_padding_name, param_padding_size) \
part \
--- /dev/null
+#include "macros.inl"
+
+collections {
+ BASE_SCALE;
+ images {
+ image: "msg_composer_bubble.#.png" RAW;
+ }
+ styles {
+ style {
+ name: "counter_style";
+ base: "font=Tizen:style=Regular font_size="21" color=#fafafa wrap=mixed ellipsis=-1 align=right";
+ }
+ }
+ group { name: "main";
+ parts {
+ PADDING_LEFT("pad.left", 12);
+ PADDING_RIGHT("pad.right", 10);
+ PADDING_TOP("pad.top", 15);
+ PADDING_BOTTOM("pad.bottom", 17);
+ part {
+ name: "bg";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default";
+ image.normal: "msg_composer_bubble.#.png";
+ color: 255 255 255 255;
+ min: 72 150;
+ max: -1 -1;
+ }
+ }
+ part { name: "swl.entry";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0.5;
+ rel1 { relative: 1.0 1.0; to_x: "pad.left"; to_y: "pad.top"; }
+ rel2 { relative: 0.0 0.0; to_x: "pad.vert"; to_y: "pad.bottom"; }
+ }
+ }
+ part { name: "pad.vert";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1 0.0;
+ rel1 { relative: 0.0 0.0; to_x: ""; }
+ rel2 { relative: 0.0 1.0; to_x: "swl.send_button"; }
+ min: 8 0;
+ max: 8 -1;
+ }
+ }
+ part { name: "swl.send_button";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1 1;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 0.0; to_y: "pad.bottom"; }
+ min: 73 56;
+ max: 73 56;
+ }
+ }
+ part { name: "pad.button1";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 1;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 0.0; to: "swl.send_button"; }
+ min: 0 6;
+ max: -1 6;
+ }
+ }
+ part { name: "pad.right.text";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 0.0 0.0; to_x: "pad.right"; to_y: "pad.button1"; }
+ min: 10 0;
+ max: 10 -1;
+ }
+ }
+ part { name: "text.counter";
+ type: TEXTBLOCK;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1 1;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 0.0 0.0; to_x: "pad.right.text"; to_y: "pad.button1"; }
+ min: 73 50;
+ max: 73 50;
+ text{
+ style: "counter_style";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
#include "FrameController.h"
#include "DefaultLayout.h"
-#include "BottomButton.h"
+#include "ComposerLayout.h"
+#include "MsgBodyView.h"
namespace Msg {
class ComposerFrame
void onHwBackButtonPreessed(Evas_Object *obj, void *event);
private:
- void prepareMainLayout();
+ void prepareLayouts();
+ void prepareBody();
+ void updateTextCounter();
private:
- DefaultLayout *m_pLayout;
+ DefaultLayout *m_pBaseLayout;
+ ComposerLayout *m_pLayout;
+ MsgBodyView *m_pBody;
};
}
ComposerFrame::ComposerFrame(NaviFrameController &parent)
: FrameController(parent)
+ , m_pBaseLayout(nullptr)
, m_pLayout(nullptr)
+ , m_pBody(nullptr)
{
MSG_LOG("");
- prepareMainLayout();
+ prepareLayouts();
+ prepareBody();
}
ComposerFrame::~ComposerFrame()
MSG_LOG("");
}
-void ComposerFrame::prepareMainLayout()
+void ComposerFrame::prepareLayouts()
{
+ if (!m_pBaseLayout) {
+ m_pBaseLayout = new DefaultLayout(getParent());
+ m_pBaseLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&ComposerFrame::onHwBackButtonPreessed), this);
+ }
+
if (!m_pLayout) {
- m_pLayout = new DefaultLayout(getParent());
- m_pLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&ComposerFrame::onHwBackButtonPreessed), this);
+ m_pLayout = new ComposerLayout(*m_pBaseLayout);
+ m_pBaseLayout->setContent(*m_pLayout);
}
}
+void ComposerFrame::prepareBody()
+{
+ if (!m_pBody) {
+ m_pBody = new MsgBodyView(*m_pLayout);
+ updateTextCounter();
+ m_pLayout->setBody(*m_pBody);
+ }
+}
+
+void ComposerFrame::updateTextCounter()
+{
+ // TODO: implementation
+ m_pBody->setCounterText(1, 160);
+ m_pBody->disabledSendButton(false);
+}
+
void ComposerFrame::onAttached(ViewItem &item)
{
MSG_LOG("");
FrameController::onAttached(item);
- setContent(*m_pLayout);
+ setContent(*m_pBaseLayout);
}
void ComposerFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event_info)
--- /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 ComposerLayout_h_
+#define ComposerLayout_h_
+
+#include "View.h"
+#include "Window.h"
+#include "App.h"
+
+#include <efl_extension.h>
+
+namespace Msg {
+ class ComposerLayout
+ : public View {
+
+ public:
+ ComposerLayout(Evas_Object *parent);
+
+ void setBody(Evas_Object *obj);
+
+ private:
+ Evas_Object *m_pLayout;
+ };
+
+ inline ComposerLayout::ComposerLayout(Evas_Object *parent)
+ : m_pLayout(nullptr)
+ {
+ setEo(elm_scroller_add(parent));
+ elm_object_style_set(getEo(), "effect");
+ elm_scroller_policy_set(getEo(), ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_scroller_bounce_set(getEo(), false, true);
+ show();
+ expand();
+
+ Evas_Object *circleScroller = eext_circle_object_scroller_add(getEo(), App::getInst().getWindow().getCircleSurface());
+ eext_circle_object_scroller_policy_set(circleScroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circleScroller, true);
+
+ m_pLayout = addLayout(parent, COMPOSER_LAYOUT_EDJ_PATH, "main");
+ expand(m_pLayout);
+ evas_object_show(m_pLayout);
+ setContent(m_pLayout);
+ }
+
+ inline void ComposerLayout::setBody(Evas_Object *obj)
+ {
+ setContent(m_pLayout, obj, "swl.body");
+ }
+}
+
+#endif /* ComposerLayout_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 MsgBodyView_h_
+#define MsgBodyView_h_
+
+#include "View.h"
+
+#include "Logger.h"
+
+
+namespace Msg {
+ class MsgBodyView
+ : public View {
+
+ public:
+ MsgBodyView(Evas_Object *parent);
+ virtual ~MsgBodyView();
+
+ std::string getText() const;
+ void clear();
+ void disabledSendButton(bool value);
+ void setCounterText(int chars, int max);
+ void setCounterText(const TText &text);
+
+ protected:
+ virtual void onSendButtonClicked() { };
+
+ private:
+ void prepareEntry();
+ void prepareSendButton();
+
+ private:
+ Evas_Object *m_pEntry;
+ Evas_Object *m_pSendButton;
+ };
+}
+
+#endif /* MsgBodyView_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.
+ */
+
+#include "MsgBodyView.h"
+
+#include <efl_extension.h>
+
+using namespace Msg;
+
+MsgBodyView::MsgBodyView(Evas_Object *parent)
+ : m_pEntry(nullptr)
+ , m_pSendButton(nullptr)
+{
+ setEo(addLayout(parent, MSG_BODY_EDJ_PATH, "main"));
+ prepareEntry();
+ prepareSendButton();
+}
+
+MsgBodyView::~MsgBodyView()
+{
+}
+
+std::string MsgBodyView::getText() const
+{
+ return markupToUtf8(elm_entry_entry_get(m_pEntry));;
+}
+
+void MsgBodyView::clear()
+{
+
+}
+
+void MsgBodyView::disabledSendButton(bool value)
+{
+ elm_object_disabled_set(m_pSendButton, value);
+}
+
+void MsgBodyView::prepareEntry()
+{
+ m_pEntry = elm_entry_add(getEo());
+ elm_entry_single_line_set(m_pEntry, false);
+ elm_entry_autocapital_type_set(m_pEntry, ELM_AUTOCAPITAL_TYPE_SENTENCE);
+ elm_entry_input_panel_return_key_type_set(m_pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
+ elm_entry_context_menu_disabled_set(m_pEntry, true);
+ elm_entry_select_allow_set(m_pEntry, false);
+ elm_object_focus_allow_set(m_pEntry, true);
+ eext_entry_selection_back_event_allow_set(m_pEntry, false);
+ elm_entry_cnp_mode_set(m_pEntry, ELM_CNP_MODE_PLAINTEXT);
+ View::setText(m_pEntry, msgt("IDS_MSG_TMBODY_TEXT_MESSAGES"), "elm.guide");
+ setContent(m_pEntry, "swl.entry");
+}
+
+void MsgBodyView::prepareSendButton()
+{
+ m_pSendButton = elm_button_add(getEo());
+ elm_object_style_set(m_pSendButton, "transparent");
+ Evas_Object *iconLayout = View::addLayout(m_pSendButton, ICONS_EDJ_PATH, "msg_body/compose_icon");
+ setContent(m_pSendButton, iconLayout);
+ addSmartCb
+ (m_pSendButton, "clicked",
+ [](void *data, Evas_Object *obj, void *event)
+ {
+ static_cast<MsgBodyView*>(data)->onSendButtonClicked();
+ }, this);
+
+ setContent(m_pSendButton, "swl.send_button");
+}
+
+void MsgBodyView::setCounterText(int chars, int max)
+{
+ std::string text = std::to_string(chars) + "<br>/" + std::to_string(max);
+ View::setText(text, "text.counter");
+}
+
+void MsgBodyView::setCounterText(const TText &text)
+{
+ View::setText(text, "text.counter");
+}
+
Evas_Object *RecipEntryView::prepareClearButton()
{
if (!m_pClearButton) {
- m_pClearButton = createButton("recip_del_icon");
+ m_pClearButton = createButton("recip/del_icon");
addSmartCb(m_pClearButton, "clicked", makeCbFirst(&RecipEntryView::onClearButtonClicked), this);
}
return m_pClearButton;
Evas_Object *RecipEntryView::prepareContactButton()
{
if (!m_pContactButton) {
- m_pContactButton = createButton("recip_contact_icon");
+ m_pContactButton = createButton("recip/contact_icon");
addSmartCb(m_pContactButton, "clicked", makeCbFirst(&RecipEntryView::onContactButtonClicked), this);
}
return m_pContactButton;
Evas_Object *ThreadComposeListViewItem::getComposeButton()
{
- Evas_Object *btn = makeButton("compose_icon");
+ Evas_Object *btn = makeButton("thread/compose_icon");
evas_object_smart_callback_add(
btn, "clicked",
[](void *data, Evas_Object *obj, void *event)
Evas_Object *ThreadComposeListViewItem::getContactsButton()
{
- Evas_Object *btn = makeButton("contacts_icon");
+ Evas_Object *btn = makeButton("thread/contacts_icon");
evas_object_smart_callback_add(
btn, "clicked",
[](void *data, Evas_Object *obj, void *event)