TSAM-8851: Missing Remove icon (X) on recipients 21/92621/1 submit/tizen/20161017.154652
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 17 Oct 2016 15:07:41 +0000 (18:07 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 17 Oct 2016 15:07:41 +0000 (18:07 +0300)
Change-Id: Icaad12f973757c27ecf99c17142b87755b491843
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
res/edje/recipient_panel.edc
src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h
src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp
src/MsgThread/View/src/MsgThreadSearchPanel.cpp

index 0cf6809..f90464d 100755 (executable)
@@ -88,7 +88,7 @@ group {
             mouse_events:  0;
             description {
                 state: "default" 0.0;
-                min: 30 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";}
@@ -102,7 +102,7 @@ group {
             mouse_events:  0;
             description {
                 state: "default" 0.0;
-                min: 17 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";}
@@ -154,37 +154,7 @@ group {
                 min: 0 MSG_COMPOSER_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: "contact_padding_left"; to_y: "entry_padding_bottom"; relative: 0.0 0.0; }
-            }
-            description {
-                state: "show_with_invalid_icon" 0.0;
-                inherit: "default" 0.0;
-                min: 0 MSG_COMPOSER_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: "img.invalid_icon"; to_y: "entry_padding_bottom"; relative: 0.0 0.0; }
-            }
-        }
-        part {
-            name: "bottom_line";
-            type: RECT;
-            scale: 1;
-            repeat_events: 1;
-            description {
-                state: "default" 0.0;
-                rel1 { to: "swl.entry"; relative: 0.0 0.0; }
-                rel2 { to: "swl.entry"; relative: 1.0 1.0; }
-                min: 0 3;
-                max: -1 3;
-                fixed: 1 1;
-                align: 0.0 1.0;
-                color: 0 0 0 51;
-                visible: 0;
-            }
-            description {
-                state: "show" 0.0;
-                inherit: "default" 0.0;
-                visible: 1;
+                rel2 { to_x: "swl.contact_btn"; to_y: "entry_padding_bottom"; relative: 0.0 0.0; }
             }
         }
         part {
@@ -243,8 +213,8 @@ group {
                 state: "default" 0.0;
                 min: 0 0;
                 fixed: 1 0;
-                rel1{relative: 0.0 0.0; to: "rect.btn";}
-                rel2{relative: 0.0 1.0; to: "rect.btn";}
+                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;
             }
         }
@@ -338,7 +308,6 @@ group {
             target: "swl.entry";
             target: "entry.main.bg";
             target: "swl.contact_btn";
-            target: "bottom_line";
         }
         program {
             name: "hide_entry";
@@ -348,7 +317,6 @@ group {
             target: "swl.entry";
             target: "entry.main.bg";
             target: "swl.contact_btn";
-            target: "bottom_line";
         }
         program {
             name: "show_invalid_icon";
index 9092b68..6fd2a43 100644 (file)
@@ -71,6 +71,7 @@ namespace Msg
             void showButton(ButtonType buttonType);
             void setEditMode(bool isEdit);
             void showInvalidIcon(bool show);
+            void showClearButton(bool show);
 
         private:
             // Out signals:
@@ -97,6 +98,7 @@ namespace Msg
             void onBtnUnpressed(Evas_Object *obj, void *event_info);
             void onContactBtnClicked(Evas_Object *obj, void *event_info);
             void onPlusBtnClicked(Evas_Object *obj, void *event_info);
+            void onClearButtonClicked(Evas_Object *obj, void *event_info);
 
             void onGeometryChanged(Evas_Object *obj, void *event_info);
 
@@ -106,6 +108,7 @@ namespace Msg
             Evas_Object *getPlusBtn();
             Evas_Object *getContactBtn();
             Evas_Object *createAreaRect(Evas_Object *parent);
+            Evas_Object *createClearButton(Evas_Object *parent);
             void setContactBtnColor(Evas_Object *btn, int r, int g, int b, int a);
             void deleteNextRecipient();
             void selectLastItem();
@@ -115,6 +118,7 @@ namespace Msg
         private:
             Evas_Object *m_pLayout;
             Evas_Object *m_pEntry;
+            Evas_Object *m_pEntryLayout;
             Evas_Object *m_pContactBtn;
             Evas_Object *m_pPlusBtn;
             Evas_Object *m_pRect;
index 92fee21..6d4d375 100644 (file)
@@ -37,6 +37,7 @@ ConvRecipientsPanelView::ConvRecipientsPanelView(Evas_Object *parent, int entryM
     : View()
     , m_pLayout(nullptr)
     , m_pEntry(nullptr)
+    , m_pEntryLayout(nullptr)
     , m_pContactBtn(nullptr)
     , m_pPlusBtn(nullptr)
     , m_pRect(nullptr)
@@ -190,15 +191,19 @@ Evas_Object *ConvRecipientsPanelView::getEntry()
     if(m_pEntry)
         return m_pEntry;
 
-    m_pEntry = elm_entry_add(m_pLayout);
+    m_pEntryLayout = elm_layout_add(m_pLayout);
+    elm_layout_theme_set(m_pEntryLayout, "layout", "searchfield", "singleline");
+    elm_object_part_content_set(m_pEntryLayout, "elm.swallow.button", createClearButton(m_pEntryLayout));
+    elm_object_part_content_set(m_pLayout, "swl.entry", m_pEntryLayout);
+
+    m_pEntry = elm_entry_add(m_pEntryLayout);
     evas_object_show(m_pEntry);
     evas_object_size_hint_weight_set(m_pEntry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set(m_pEntry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    emitSignal(m_pEntry, "elm,action,hide,search_icon", "");
-    elm_entry_editable_set(m_pEntry, EINA_TRUE);
-    elm_entry_single_line_set(m_pEntry, EINA_TRUE);
-    elm_entry_scrollable_set(m_pEntry, EINA_TRUE);
-    eext_entry_selection_back_event_allow_set(m_pEntry, EINA_TRUE);
+    elm_entry_editable_set(m_pEntry, true);
+    elm_entry_single_line_set(m_pEntry, true);
+    elm_entry_scrollable_set(m_pEntry, true);
+    eext_entry_selection_back_event_allow_set(m_pEntry, true);
     elm_scroller_policy_set(m_pEntry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
     elm_entry_autocapital_type_set(m_pEntry, ELM_AUTOCAPITAL_TYPE_NONE);
     elm_entry_input_panel_return_key_type_set(m_pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT);
@@ -215,8 +220,8 @@ Evas_Object *ConvRecipientsPanelView::getEntry()
     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);
     addGeometryChangedCb(m_pEntry);
-    elm_object_part_content_set(m_pLayout, "swl.entry", m_pEntry);
-    return m_pEntry;
+    elm_object_content_set(m_pEntryLayout, m_pEntry);
+    return m_pEntryLayout;
 }
 
 Evas_Object *ConvRecipientsPanelView::createAreaRect(Evas_Object *parent)
@@ -227,6 +232,17 @@ Evas_Object *ConvRecipientsPanelView::createAreaRect(Evas_Object *parent)
     return m_pRect;
 }
 
+Evas_Object *ConvRecipientsPanelView::createClearButton(Evas_Object *parent)
+{
+    Evas_Object *button = elm_button_add(parent);
+    evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvRecipientsPanelView, onClearButtonClicked), this);
+    elm_object_focus_allow_set(button, false);
+    evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvRecipientsPanelView, onClearButtonClicked), this);;
+    elm_object_style_set(button, "editfield_clear");
+    evas_object_show(button);
+    return button;
+}
+
 Evas_Object *ConvRecipientsPanelView::getContactBtn()
 {
     if(m_pContactBtn)
@@ -436,13 +452,23 @@ void ConvRecipientsPanelView::showInvalidIcon(bool show)
     emitSignal(m_pLayout, sig, "*");
 }
 
+void ConvRecipientsPanelView::showClearButton(bool show)
+{
+    const char *sig = show ? "elm,action,show,button" : "elm,action,hide,button";
+    emitSignal(m_pEntryLayout, sig, "");
+}
+
 void ConvRecipientsPanelView::onEntryChanged(Evas_Object *obj, void *event_info)
 {
+    MSG_LOG("");
+    showClearButton(getEntryFocus() && !isEntryEmpty());
     onEntryChanged();
 }
 
 void ConvRecipientsPanelView::onEntryFocusChanged(Evas_Object *obj, void *event_info)
 {
+    MSG_LOG("");
+    showClearButton(getEntryFocus() && !isEntryEmpty());
     onEntryFocusChanged();
 }
 
@@ -484,6 +510,12 @@ void ConvRecipientsPanelView::onPlusBtnClicked(Evas_Object *obj, void *event_inf
     onPlusButtonClicked();
 }
 
+void ConvRecipientsPanelView::ConvRecipientsPanelView::onClearButtonClicked(Evas_Object *obj, void *event_info)
+{
+    MSG_LOG("");
+    clearEntry();
+}
+
 MbeRecipientItem *ConvRecipientsPanelView::getSelectedItem() const
 {
     return m_pMbe ? m_pMbe->getSelectedItem() : nullptr;
index 4309686..03f0d20 100644 (file)
@@ -92,7 +92,7 @@ Evas_Object *MsgThreadSearchPanel::createEntry(Evas_Object *parent)
     Evas_Object *btn = createClearButton(m_pEntry);
     evas_object_show(btn);
     elm_object_focus_allow_set(btn, false);
-    evas_object_smart_callback_add(btn, "clicked", SMART_CALLBACK(MsgThreadSearchPanel, onClearButtonClicked), this);;
+    evas_object_smart_callback_add(btn, "clicked", SMART_CALLBACK(MsgThreadSearchPanel, onClearButtonClicked), this);
     elm_object_part_content_set(getEo(), "elm.swallow.button", btn);
 
     return m_pEntry;