jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=746ac264254705f9365e4aeed9afb80edf39f6e8

commit 746ac264254705f9365e4aeed9afb80edf39f6e8
Author: Woochan Lee <wc0917....@samsung.com>
Date:   Mon Jan 16 11:48:48 2017 +0900

    elm_multibuttonentry: Fix MBE got a wrong state.
    
    Summary:
    Even User set a MBE state as "shrink" when MBE created.
    MBE has been changed the state as "none" during added items.
    
    This patch will be fixed that bug state.
    
    @fix
    
    Test Plan:
    Add below line after create mbe.
    
    'elm_multibuttonentry_expanded_set(mbe, EINA_FALSE)'
    
    Then Add items using item_append API.
    
    See the result. mbe is not on shrink mode.
    
    Reviewers: Hermet, jpeg, cedric
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4548
---
 src/bin/elementary/test.c                  |  2 +
 src/bin/elementary/test_multibuttonentry.c | 86 ++++++++++++++++++++++++++++++
 src/lib/elementary/elc_multibuttonentry.c  | 21 ++++----
 3 files changed, 99 insertions(+), 10 deletions(-)

diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 22209ec..6e26387 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -73,6 +73,7 @@ void test_entry8(void *data, Evas_Object *obj, void 
*event_info);
 void test_entry_regex(void *data, Evas_Object *obj, void *event_info);
 void test_entry_notepad(void *data, Evas_Object *obj, void *event_info);
 void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info);
+void test_multibuttonentry2(void *data, Evas_Object *obj, void *event_info);
 void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info);
 void test_entry_anchor(void *data, Evas_Object *obj, void *event_info);
 void test_entry_emoticon(void *data, Evas_Object *obj, void *event_info);
@@ -715,6 +716,7 @@ add_tests:
    ADD_TEST(NULL, "Entries", "Entry Regex", test_entry_regex);
    ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad);
    ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry);
+   ADD_TEST(NULL, "Entries", "Multibuttonentry Shrink", 
test_multibuttonentry2);
    ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor);
    ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2);
    ADD_TEST(NULL, "Entries", "Entry Emoticon", test_entry_emoticon);
diff --git a/src/bin/elementary/test_multibuttonentry.c 
b/src/bin/elementary/test_multibuttonentry.c
index f66fc8c..e9738f3 100644
--- a/src/bin/elementary/test_multibuttonentry.c
+++ b/src/bin/elementary/test_multibuttonentry.c
@@ -252,3 +252,89 @@ test_multibuttonentry(void *data EINA_UNUSED,
    evas_object_resize(win, 320, 480);
    evas_object_show(win);
 }
+
+static Evas_Object*
+_add_multibuttonentry_shrink(Evas_Object *parent)
+{
+   Evas_Object *scr = NULL;
+   Evas_Object *mbe = NULL;
+   Evas_Object *btn = NULL;
+   void *data = NULL;
+
+   scr = elm_scroller_add(parent);
+   elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE);
+   elm_scroller_policy_set(scr, 
ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO);
+   evas_object_show(scr);
+
+   mbe = elm_multibuttonentry_add(parent);
+   elm_object_text_set(mbe, "To: ");
+   elm_object_part_text_set(mbe, "guide", "Tap to add recipient");
+   evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_content_set(scr, mbe);
+   elm_multibuttonentry_expanded_set(mbe, EINA_FALSE);
+
+   elm_multibuttonentry_item_append(mbe, "mbe1", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe2", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe3", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe4", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe5", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe6", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe7", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe8", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe9", _select_cb, NULL);
+   elm_multibuttonentry_item_append(mbe, "mbe10", _select_cb, NULL);
+
+   // Add item verify callback to Multibuttonentry
+   elm_multibuttonentry_item_filter_append(mbe, _item_filter_cb, data);
+
+   // Add "item,selected","item,added", "item,deleted", "clicked", "unfocused",
+   // "expanded", "contracted" and "contracted,state,changed" smart callback
+   evas_object_smart_callback_add(mbe, "item,selected", _item_selected_cb, 
NULL);
+   evas_object_smart_callback_add(mbe, "item,added", _item_added_cb, NULL);
+   evas_object_smart_callback_add(mbe, "item,deleted", _item_deleted_cb, NULL);
+   evas_object_smart_callback_add(mbe, "item,clicked", _item_clicked_cb, NULL);
+
+   evas_object_smart_callback_add(mbe, "clicked", _mbe_clicked_cb, NULL);
+   evas_object_smart_callback_add(mbe, "focused", _mbe_focused_cb, NULL);
+   evas_object_smart_callback_add(mbe, "unfocused", _mbe_unfocused_cb, NULL);
+
+   evas_object_smart_callback_add(mbe, "expanded", _expanded_cb, NULL);
+   evas_object_smart_callback_add(mbe, "contracted", _contracted_cb, NULL);
+   evas_object_smart_callback_add(mbe, "shrink,state,changed", 
_shrink_state_changed_cb, NULL);
+   evas_object_smart_callback_add(mbe, "item,longpressed", _longpressed_cb, 
NULL);
+
+   btn = _format_change_btn_add(mbe);
+   elm_object_part_content_set(parent, "box", btn);
+
+   evas_object_resize(mbe, 220, 300);
+   elm_object_focus_set(mbe, EINA_TRUE);
+
+   return scr;
+}
+
+void
+test_multibuttonentry2(void *data EINA_UNUSED,
+                      Evas_Object *obj EINA_UNUSED,
+                      void *event_info EINA_UNUSED)
+{
+   Evas_Object *win, *sc;
+   Evas_Object *ly;
+   char buf[PATH_MAX];
+
+   win = elm_win_util_standard_add("multibuttonentry", "MultiButtonEntry");
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   ly = elm_layout_add(win);
+   snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", 
elm_app_data_dir_get());
+   elm_layout_file_set(ly, buf, "multibuttonentry_test");
+   evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, ly);
+   evas_object_show(ly);
+
+   sc = _add_multibuttonentry_shrink(ly);
+   elm_object_part_content_set(ly, "multibuttonentry", sc);
+
+   evas_object_resize(win, 320, 480);
+   evas_object_show(win);
+}
diff --git a/src/lib/elementary/elc_multibuttonentry.c 
b/src/lib/elementary/elc_multibuttonentry.c
index 1accaa0..2ab94b7 100644
--- a/src/lib/elementary/elc_multibuttonentry.c
+++ b/src/lib/elementary/elc_multibuttonentry.c
@@ -181,10 +181,7 @@ _shrink_mode_set(Evas_Object *obj,
    else if (sd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT)
      evas_object_hide(sd->guide_text);
    else if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
-     {
-        evas_object_hide(sd->end);
-        sd->view_state = MULTIBUTTONENTRY_VIEW_NONE;
-     }
+     evas_object_hide(sd->end);
 
    if (shrink == EINA_TRUE)
      {
@@ -266,12 +263,13 @@ _shrink_mode_set(Evas_Object *obj,
                   elm_box_pack_end(sd->box, sd->end);
                   evas_object_show(sd->end);
 
-                  sd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK;
-                  efl_event_callback_legacy_call
-                    (obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, 
(void *)1);
                   break;
                }
           }
+
+        sd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK;
+        efl_event_callback_legacy_call
+          (obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)1);
      }
    else
      {
@@ -840,9 +838,6 @@ _item_new(Elm_Multibuttonentry_Data *sd,
         item->func = func;
      }
 
-   if (!elm_object_focus_get(obj) && sd->view_state == 
MULTIBUTTONENTRY_VIEW_SHRINK && sd->w_box)
-     _shrink_mode_set(obj, EINA_TRUE);
-
    switch (pos)
      {
       case MULTIBUTTONENTRY_POS_START:
@@ -943,6 +938,10 @@ _item_new(Elm_Multibuttonentry_Data *sd,
         break;
      }
 
+   if (!elm_object_focus_get(obj) && sd->view_state == 
MULTIBUTTONENTRY_VIEW_SHRINK && sd->w_box)
+     _shrink_mode_set(obj, EINA_TRUE);
+
+
    efl_event_callback_legacy_call
      (obj, ELM_MULTIBUTTONENTRY_EVENT_ITEM_ADDED, eo_item);
 
@@ -1008,6 +1007,8 @@ _box_resize_cb(void *data,
    ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
 
    evas_object_geometry_get(sd->box, NULL, NULL, &w, &h);
+   if ((w <= elm_config_finger_size_get()) || (h <= 
elm_config_finger_size_get())) return;
+
    elm_box_padding_get(obj, &hpad, NULL);
 
    if (sd->h_box < h)

-- 


Reply via email to