From 9666bdcd46da11c9192afa6262a77086c7b84465 Mon Sep 17 00:00:00 2001 From: Oleksander Kostenko Date: Fri, 19 May 2017 17:36:02 +0300 Subject: [PATCH] TizenRefApp-7841 Recipients field overlap attachments in Composer Change-Id: I4e8a0515363f49549cdf5c0df8802a21a24d890c Signed-off-by: Oleksander Kostenko --- res/edje/conv_layout.edc | 18 +- res/edje/recipient_panel.edc | 353 +++++++----------- .../Main/Controller/inc/Conversation.h | 4 +- .../Main/Controller/src/Conversation.cpp | 13 + .../Main/View/inc/ConversationLayout.h | 3 +- .../Main/View/src/ConversationLayout.cpp | 10 + .../Controller/inc/ConvRecipientsPanel.h | 2 + .../Controller/src/ConvRecipientsPanel.cpp | 6 + .../View/inc/ConvRecipientsPanelView.h | 5 + .../View/src/ConvRecipientsPanelView.cpp | 13 + 10 files changed, 207 insertions(+), 220 deletions(-) diff --git a/res/edje/conv_layout.edc b/res/edje/conv_layout.edc index 65c2d9ca..5f75001b 100755 --- a/res/edje/conv_layout.edc +++ b/res/edje/conv_layout.edc @@ -1,8 +1,6 @@ #include "macros.inl" #include "colors_define.inl" -#define RECIPIENT_TO_FIELD_MIN_H 81 - collections { BASE_SCALE; group @@ -19,7 +17,19 @@ collections { color: CONV_BG_COLOR; } } - PADDING_TOP("conv_list.pad.top", RECIPIENT_TO_FIELD_MIN_H); + part { + name: "entry.pad.top"; + type: SWALLOW; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + rel1{relative: 0.0 0.0;} + rel2{relative: 1.0 0.0;} + align: 0.0 0.0; + visible: 0; + } + } part { name: "swl.bubble"; type: SWALLOW; @@ -34,7 +44,7 @@ collections { description { state: "show.conv_list.pad" 0.0; inherit: "default" 0.0; - rel1 {to_y: "conv_list.pad.top"; relative: 0.0 1.0;} + rel1 {to_y: "entry.pad.top"; relative: 0.0 1.0;} } } part { diff --git a/res/edje/recipient_panel.edc b/res/edje/recipient_panel.edc index 8f58ba83..c31f3f6b 100755 --- a/res/edje/recipient_panel.edc +++ b/res/edje/recipient_panel.edc @@ -7,333 +7,258 @@ #define RECIP_FAILED_COLOR 246 183 183 255 collections { - BASE_SCALE; + BASE_SCALE; -group { - name: "recipient_panel"; - images { - image: "messages_recipients_failed_bg.png" COMP; - image: "messages_recipients_failed.png" COMP; - } - parts { - part { - name: "space"; - type: SPACER; - scale: 1; - description { - state: "default" 0.0; - min: 0 RECIPIENT_TO_FIELD_MIN_H; - rel1.to: "swl.mbe"; - rel2.to: "entry.main.bg"; - } - } - PADDING_TOP("padding_top", 0); - PADDING_LEFT("padding_left", 0); - PADDING_RIGHT("padding_right", 0); - PADDING_BOTTOM("padding_bottom", 0); - part { + group { + name: "recipient_panel"; + images { + image: "messages_recipients_failed_bg.png" COMP; + image: "messages_recipients_failed.png" COMP; + } + parts { + part { name: "mbe.bg"; type: RECT; scale: 1; description { - rel1 { to: "swl.mbe";} - rel2 { to: "swl.mbe";} - color: CONV_BG_COLOR; + rel.to: "swl.mbe"; + color: CONV_BG_COLOR; } - } - part { + } + part { name: "swl.mbe"; type: SWALLOW; scale: 1; description { - state: "default" 0.0; //when TO mbe is hidden - rel1 { to_x: "padding_left"; relative: 1.0 0.0; } - rel2 { to_x: "padding_right"; relative: 0.0 0.0; } - align: 0.0 1.0; - visible: 0; + state: "default" 0.0; //when TO mbe is hidden + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 0.0; + align: 0.0 1.0; + visible: 1; } description { - state: "show" 0.0; //When TO mbe is shown - rel1 { to_x: "padding_left"; 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; - visible: 1; + state: "show" 0.0; //When TO mbe is shown + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 0.0; + align: 0.0 0.0; + visible: 1; } - } - part { + } + part { name: "entry.main.bg"; type: RECT; scale: 1; description { - state: "default" 0.0; - min: 0 0; - max: -1 0; - visible: 0; - } - description { - state: "show" 0.0; - min: 0 RECIPIENT_TO_FIELD_MIN_H; - fixed: 1 1; - visible: 1; - align: 0.0 0.0; - color: CONV_BG_COLOR; - rel1 { to_y: "swl.mbe"; relative: 0.0 1.0; } - rel2 { to_y: "swl.mbe"; relative: 1.0 1.0; } - } - } - part { - name: "entry_padding_left"; - type: SPACER; - scale: 1; - mouse_events: 0; - description { - state: "default" 0.0; - min: 0 0; - fixed: 1 0; - rel1{relative: 0.0 0.0; to: "entry.main.bg";} - rel2{relative: 0.0 1.0; to: "entry.main.bg";} - align: 0.0 0.0; + state: "default" 0.0; + rel1.to: "swl.entry"; + rel1.relative: 0 0; + rel2.to_y: "swl.entry"; + rel2.relative: 1 1; + align: 0.5 0.5; + color: CONV_BG_COLOR; + visible: 1; } - } - part { - name: "entry_padding_right"; - type: SPACER; - scale: 1; - mouse_events: 0; - description { - state: "default" 0.0; - min: 0 0; - fixed: 1 0; - rel1{relative: 1.0 0.0; to: "entry.main.bg";} - rel2{relative: 1.0 1.0; to: "entry.main.bg";} - align: 1.0 0.0; - } - } - part { - name: "entry_padding_top"; - type: SPACER; - scale: 1; - mouse_events: 0; - description { - state: "default" 0.0; - min: 0 0; - fixed: 0 1; - rel1{relative: 0.0 0.0; to: "entry.main.bg";} - rel2{relative: 1.0 0.0; to: "entry.main.bg";} - align: 0.0 0.0; - } - } - part { - name: "entry_padding_bottom"; - type: SPACER; - scale: 1; - mouse_events: 0; - description { - state: "default" 0.0; - min: 0 0; - fixed: 0 1; - rel1{relative: 0.0 1.0; to: "entry.main.bg";} - rel2{relative: 1.0 1.0; to: "entry.main.bg";} - align: 0.0 1.0; - } - } - part { + } + part { name: "swl.entry"; type: SWALLOW; scale: 1; description { - state: "default" 0.0; - visible: 1; - fixed: 1 1; - min: 0 0; - max: 0 0; + state: "default" 0.0; + visible: 1; + fixed: 1 1; + min: 0 0; + max: 0 0; } description { - state: "show" 0.0; - inherit: "default" 0.0; - min: 0 RECIPIENT_TO_FIELD_MIN_H; - max: -1 -1; - rel1 { to_x: "entry_padding_left"; to_y: "entry_padding_top"; relative: 1.0 1.0; } - rel2 { to_x: "swl.contact_btn"; to_y: "entry_padding_bottom"; relative: 0.0 0.0; } + state: "show" 0.0; + inherit: "default" 0.0; + max: -1 -1; + align: 0.5 0.0; + rel1 { to: "swl.mbe"; relative: 0.0 1.0; } + rel2 { to_x: "swl.contact_btn"; to_y: "swl.mbe"; relative: 0.0 1.0; } } - } - part { + } + part { name: "img.invalid_icon_bg"; type: IMAGE; scale: 1; description { - state: "default" 0.0; - image.normal: "messages_recipients_failed_bg.png"; - min: 0 0; - max: 0 0; - fixed: 1 1; - rel1 { to: "contact_padding_left"; relative: 0.0 0.0;} - rel2 { to: "contact_padding_left"; relative: 0.0 1.0;} - align: 1.0 0.5; - color: RECIP_FAILED_COLOR; - visible: 0; + state: "default" 0.0; + image.normal: "messages_recipients_failed_bg.png"; + min: 0 0; + max: 0 0; + fixed: 1 1; + rel1 { to: "contact_padding_left"; relative: 0.0 0.0;} + rel2 { to: "contact_padding_left"; relative: 0.0 1.0;} + align: 1.0 0.5; + color: RECIP_FAILED_COLOR; + visible: 0; } description { - state: "show" 0.0; - inherit: "default" 0.0; - min: BUTTON_SIZE; - max: BUTTON_SIZE; - visible: 1; + state: "show" 0.0; + inherit: "default" 0.0; + min: BUTTON_SIZE; + max: BUTTON_SIZE; + visible: 1; } - } - part { + } + part { name: "img.invalid_icon"; type: IMAGE; scale: 1; description { - state: "default" 0.0; - image.normal: "messages_recipients_failed.png"; - min: 0 0; - max: 0 0; - fixed: 1 1; - rel1 { to: "contact_padding_left"; relative: 0.0 0.0;} - rel2 { to: "contact_padding_left"; relative: 0.0 1.0;} - align: 1.0 0.5; - visible: 0; + state: "default" 0.0; + image.normal: "messages_recipients_failed.png"; + min: 0 0; + max: 0 0; + fixed: 1 1; + rel1 { to: "contact_padding_left"; relative: 0.0 0.0;} + rel2 { to: "contact_padding_left"; relative: 0.0 1.0;} + align: 1.0 0.5; + visible: 0; } description { - state: "show" 0.0; - inherit: "default" 0.0; - min: BUTTON_SIZE; - max: BUTTON_SIZE; - visible: 1; + state: "show" 0.0; + inherit: "default" 0.0; + min: BUTTON_SIZE; + max: BUTTON_SIZE; + visible: 1; } - } - part { + } + part { name: "contact_padding_left"; type: SPACER; scale: 1; mouse_events: 0; description { - state: "default" 0.0; - min: 0 0; - fixed: 1 0; - rel1{relative: 0.0 0.0; to: "swl.contact_btn";} - rel2{relative: 0.0 1.0; to: "swl.contact_btn";} - align: 1.0 0.0; + state: "default" 0.0; + min: 0 0; + fixed: 1 0; + rel1{relative: 0.0 0.0; to: "swl.contact_btn";} + rel2{relative: 0.0 1.0; to: "swl.contact_btn";} + align: 1.0 0.0; } - } - part { + } + part { name: "swl.contact_btn"; type: SWALLOW; scale: 1; mouse_events: 1; description { - state: "default" 0.0; - visible: 0; + state: "default" 0.0; + visible: 0; + min: 50 50; + fixed: 1 1; + align: 0.5 0.5; + rel.to: "rect.btn"; + align: 0.5 0.5; } description { - state: "show" 0.0; - inherit: "default" 0.0; - min: 50 50; - fixed: 1 1; - align: 0.5 0.5; - visible: 1; - rel1 { to: "rect.btn"; relative: 0.0 0.0; } - rel2 { to: "rect.btn"; relative: 1.0 1.0; } - align: 0.5 0.5; + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; } - } - part { + } + part { name: "rect.btn"; type: SPACER; scale: 1; mouse_events: 0; description { - state: "default" 0.0; //hide prev button - min: BUTTON_RECT_SIZE; - max: BUTTON_RECT_SIZE; - fixed: 1 1; - rel1 { to_x: "entry_padding_right"; to_y: "entry_padding_top"; relative: 0.0 1.0; } - rel2 { to_x: "entry_padding_right"; to_y: "entry_padding_bottom"; relative: 0.0 0.0; } - align: 1.0 0.5; + state: "default" 0.0; //hide prev button + min: BUTTON_RECT_SIZE; + max: BUTTON_RECT_SIZE; + fixed: 1 1; + rel1 { + to: "swl.entry"; + relative: 1 0; + } + rel2 { + to_y: "swl.entry"; + relative: 1 1; + } + align: 1.0 0.5; } - } - } - programs { - program { + } + } + programs { + program { name: "hide.ct_button"; signal: "hide.ct_button"; source: "*"; action: STATE_SET "default" 0.0; target: "swl.contact_btn"; - } - program { + } + program { name: "show.ct_button"; signal: "show.ct_button"; source: "*"; action: STATE_SET "show" 0.0; target: "swl.contact_btn"; - } - program { + } + program { name: "show_to_mbe_anim"; signal: "show_to_mbe_anim"; source: "*"; action: STATE_SET "show" 0.0; target: "swl.mbe"; transition: LINEAR 0.2; - } - program { + } + program { name: "hide_to_mbe_anim"; signal: "hide_to_mbe_anim"; source: "*"; action: STATE_SET "default" 0.0; target: "swl.mbe"; transition: LINEAR 0.2; - } - program { + } + program { name: "show_to_mbe"; signal: "show_to_mbe"; source: "*"; action: STATE_SET "show" 0.0; target: "swl.mbe"; - } - program { + } + program { name: "hide_to_mbe"; signal: "hide_to_mbe"; source: "*"; action: STATE_SET "default" 0.0; target: "swl.mbe"; - } - program { + } + program { name: "show_entry"; signal: "show_entry"; source: "*"; action: STATE_SET "show" 0.0; target: "swl.entry"; - target: "entry.main.bg"; target: "swl.contact_btn"; - } - program { + } + program { name: "hide_entry"; signal: "hide_entry"; source: "*"; action: STATE_SET "default" 0.0; target: "swl.entry"; - target: "entry.main.bg"; target: "swl.contact_btn"; - } - program { + } + program { name: "show_invalid_icon"; signal: "show_invalid_icon"; source: "*"; action: STATE_SET "show" 0.0; target: "img.invalid_icon"; target: "img.invalid_icon_bg"; - } - program { + } + program { name: "hide_invalid_icon"; signal: "hide_invalid_icon"; source: "*"; action: STATE_SET "default" 0.0; target: "img.invalid_icon"; target: "img.invalid_icon_bg"; - } - } -} + } + } + } } diff --git a/src/Conversation/Main/Controller/inc/Conversation.h b/src/Conversation/Main/Controller/inc/Conversation.h index 223ecf3b..b0db7695 100644 --- a/src/Conversation/Main/Controller/inc/Conversation.h +++ b/src/Conversation/Main/Controller/inc/Conversation.h @@ -97,12 +97,13 @@ namespace Msg { // IMessageInputPanelListener: virtual void onButtonClicked(MessageInputPanel &obj, MessageInputPanel::ButtonId id); - // IRecipientsPanelListener: + // IConvRecipientsPanelListener: virtual void onMbeChanged(ConvRecipientsPanel &panel); virtual void onKeyDown(ConvRecipientsPanel &panel, Evas_Event_Key_Down &ev); virtual void onEntryFocusChanged(ConvRecipientsPanel &panel); virtual void onEntryChanged(ConvRecipientsPanel &panel); virtual void onItemClicked(ConvRecipientsPanel &panel, MbeRecipientItem &item); + virtual void onEntrySizeChanged(ConvRecipientsPanel &panel); // IBodyListener: virtual void onChanged(Body &body); @@ -161,6 +162,7 @@ namespace Msg { void updateMsgInputPanel(); void updateNavibar(); void updateSelectMsgTitle(); + void updateRecipientArea(); void createMainLayout(); void markAsRead(); void recipientClickHandler(const std::string &address); diff --git a/src/Conversation/Main/Controller/src/Conversation.cpp b/src/Conversation/Main/Controller/src/Conversation.cpp index cd665e56..4418d429 100644 --- a/src/Conversation/Main/Controller/src/Conversation.cpp +++ b/src/Conversation/Main/Controller/src/Conversation.cpp @@ -356,6 +356,7 @@ void Conversation::setNewMessageMode() m_pRecipPanel->showMbe(!m_pRecipPanel->isMbeEmpty()); m_pRecipPanel->showEntry(true); m_pRecipPanel->setEntryFocus(true); // TODO: Not bad to remove from here + updateRecipientArea(); } void Conversation::setConversationMode() @@ -960,6 +961,11 @@ void Conversation::onItemClicked(ConvRecipientsPanel &panel, MbeRecipientItem &i recipientClickHandler(item.getAddress()); } +void Conversation::onEntrySizeChanged(ConvRecipientsPanel &panel) +{ + updateRecipientArea(); +} + void Conversation::onChanged(Body &body) { updateMsgInputPanel(); @@ -1027,6 +1033,13 @@ void Conversation::updateSelectMsgTitle() } } +void Conversation::updateRecipientArea() +{ + MSG_LOG(""); + int height = m_pRecipPanel->getEntryHeight(); + m_pLayout->setRecipEntryHeight(height); +} + void Conversation::onButtonClicked(MessageInputPanel &obj, MessageInputPanel::ButtonId id) { MSG_LOG("MessageInputPanel: button clicked: id = ", id); diff --git a/src/Conversation/Main/View/inc/ConversationLayout.h b/src/Conversation/Main/View/inc/ConversationLayout.h index 044e0ffd..63322116 100644 --- a/src/Conversation/Main/View/inc/ConversationLayout.h +++ b/src/Conversation/Main/View/inc/ConversationLayout.h @@ -36,14 +36,15 @@ namespace Msg { void setRecipientRect(Evas_Object *layout); void showRecipEditMode(bool show); void showMsgInputPanel(bool show); + void setRecipEntryHeight(int height); private: void create(Evas_Object *parent); Evas_Object *createMainLayout(Evas_Object *parent); - Evas_Object *createRecipientAreaRect(Evas_Object *parent); private: Evas_Object *m_pLayout; + Evas_Object *m_pRect; }; } diff --git a/src/Conversation/Main/View/src/ConversationLayout.cpp b/src/Conversation/Main/View/src/ConversationLayout.cpp index 6b7068df..b8bb125d 100644 --- a/src/Conversation/Main/View/src/ConversationLayout.cpp +++ b/src/Conversation/Main/View/src/ConversationLayout.cpp @@ -22,6 +22,7 @@ using namespace Msg; ConversationLayout::ConversationLayout(Evas_Object *parent) : View() , m_pLayout(nullptr) + , m_pRect(nullptr) { create(parent); } @@ -88,3 +89,12 @@ Evas_Object *ConversationLayout::createMainLayout(Evas_Object *parent) return layout; } +void ConversationLayout::setRecipEntryHeight(int height) +{ + if (!m_pRect) { + m_pRect = evas_object_rectangle_add(evas_object_evas_get(m_pLayout)); + setContent(m_pRect, "entry.pad.top"); + } + + evas_object_size_hint_min_set(m_pRect, 0, height); +} diff --git a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h index e1392bef..08533d81 100644 --- a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h +++ b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h @@ -56,6 +56,7 @@ namespace Msg { virtual void onContactButtonClicked(); virtual void onPlusButtonClicked(); virtual void onEntryChanged(); + virtual void onEntrySizeChanged(); // IMbeRecipientsListener virtual void onMbeItemClicked(MbeRecipientItem &item); @@ -98,6 +99,7 @@ namespace Msg { virtual void onMbeChanged(ConvRecipientsPanel &panel) {}; virtual void onItemClicked(ConvRecipientsPanel &panel, MbeRecipientItem &item) {}; virtual void onEntryChanged(ConvRecipientsPanel &panel) {}; + virtual void onEntrySizeChanged(ConvRecipientsPanel &panel) {}; }; } diff --git a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp index ab74cd29..ab2a59af 100644 --- a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp +++ b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp @@ -239,6 +239,12 @@ void ConvRecipientsPanel::onEntryChanged() m_pListener->onEntryChanged(*this); } +void ConvRecipientsPanel::onEntrySizeChanged() +{ + if (m_pListener) + m_pListener->onEntrySizeChanged(*this); +} + void ConvRecipientsPanel::onContactButtonClicked() { MSG_LOG(""); diff --git a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h index 39df3886..d53ef85f 100644 --- a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h +++ b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h @@ -34,6 +34,7 @@ namespace Msg { void removeSelectedItem(); void unselectMbeItem(); Evas_Object *getAreaRect() const; + int getEntryHeight() const; void showMbe(bool show, bool animation = true); void showEntry(bool show); std::string getEntryText() const; @@ -69,6 +70,8 @@ namespace Msg { void showInvalidIcon(bool show); void showClearButton(bool show); void setButtonEnabled(ButtonType buttonType, bool enabled); + + private: // Out signals: virtual void onKeyDown(Evas_Event_Key_Down *ev) {}; @@ -76,6 +79,7 @@ namespace Msg { virtual void onContactButtonClicked() {} virtual void onPlusButtonClicked() {} virtual void onEntryChanged() {} + virtual void onEntrySizeChanged() {} private: void onMbeFocused(Evas_Object *obj, void *event_info); @@ -97,6 +101,7 @@ namespace Msg { void onClearButtonClicked(Evas_Object *obj, void *event_info); void onGeometryChanged(Evas_Object *obj, void *event_info); + void onEntrySizeChanged(Evas_Object *obj, void *event_info); private: void create(Evas_Object *parent); diff --git a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp index 0b9d41cc..4f2819d8 100644 --- a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp +++ b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp @@ -236,6 +236,7 @@ Evas_Object *ConvRecipientsPanelView::getEntry() evas_object_smart_callback_add(m_pEntry, "clicked", SMART_CALLBACK(ConvRecipientsPanelView, onEntryClicked), this); evas_object_smart_callback_add(m_pEntry, "maxlength,reached", SMART_CALLBACK(ConvRecipientsPanelView, onEntryMaxlengthReached), this); evas_object_event_callback_add(m_pEntry, EVAS_CALLBACK_KEY_DOWN, EVAS_EVENT_CALLBACK(ConvRecipientsPanelView, onKeyDown), this); + evas_object_event_callback_add(m_pEntryLayout, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvRecipientsPanelView, onEntrySizeChanged), this); addGeometryChangedCb(m_pEntry); elm_object_content_set(m_pEntryLayout, m_pEntry); processSignal(m_pEntryLayout); @@ -325,6 +326,18 @@ Evas_Object *ConvRecipientsPanelView::getAreaRect() const return m_pRect; } +int ConvRecipientsPanelView::getEntryHeight() const +{ + int h = 0; + evas_object_geometry_get(m_pEntryLayout, nullptr, nullptr, nullptr, &h); + return h; +} + +void ConvRecipientsPanelView::onEntrySizeChanged(Evas_Object *obj, void *event_info) +{ + onEntrySizeChanged(); +} + void ConvRecipientsPanelView::onGeometryChanged(Evas_Object *obj, void *event_info) { int y = 0; -- 2.34.1