genlist: fix re-positioning issue in item prepending 39/89839/3
authorSangHyeon Lee <sh10233.lee@samsung.com>
Tue, 27 Sep 2016 06:57:56 +0000 (15:57 +0900)
committerSangHyeon Lee <sh10233.lee@samsung.com>
Thu, 20 Oct 2016 01:40:39 +0000 (10:40 +0900)
Change-Id: I3cd6249e8cf405d1088842981edec999333acb97

src/lib/elm_genlist.c
src/lib/elm_widget_genlist.h

index ff83bff..bb1f08c 100644 (file)
@@ -2524,6 +2524,25 @@ _elm_genlist_pan_evas_object_smart_calculate(Eo *obj, Elm_Genlist_Pan_Data *psd)
        (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_NONE))
      _item_auto_scroll(sd);
 
+   //FIXME: There are issue about wrong list positioning in prepend cases.
+   // To prevent the issue, allocate repositioning in smart calculate.
+   if (sd->prepend_items)
+     {
+        Evas_Coord prepend_h = 0;
+        Elm_Gen_Item *tmp = NULL;
+        EINA_LIST_FREE(sd->prepend_items, tmp)
+          {
+             prepend_h += tmp->item->minh;
+          }
+
+        eo_do((sd)->obj,
+              elm_interface_scrollable_content_pos_get(&vx, &vy),
+              elm_interface_scrollable_content_viewport_geometry_get
+              (NULL, NULL, &vw, &vh));
+        /* Set adjusted position as prepended items height */
+        eo_do((sd)->obj, elm_interface_scrollable_content_region_show(vx, vy + prepend_h, vw, vh));
+     }
+
    eo_do((sd)->obj,
          elm_interface_scrollable_content_pos_get(&vx, &vy),
          elm_interface_scrollable_content_viewport_geometry_get
@@ -4622,6 +4641,11 @@ _item_process_post(Elm_Genlist_Data *sd,
         eo_it2 = sd->selected->data;
         ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
         if (!it2->item->block) return;
+
+        //FIXME: There are issue about wrong list positioning in prepend cases.
+        // To prevent the issue, allocate repositioning in smart calculate.
+        sd->prepend_items = eina_list_append(sd->prepend_items, it);
+#if 0
         eo_do(sd->obj, elm_interface_scrollable_content_pos_get(NULL, &y));
         evas_object_geometry_get(sd->pan_obj, NULL, NULL, NULL, &h);
         if ((it->y + it->item->block->y > y + h) ||
@@ -4634,6 +4658,7 @@ _item_process_post(Elm_Genlist_Data *sd,
            eo_do(sd->obj, elm_interface_scrollable_content_region_show
             (it->x + it->item->block->x,
             y + it->item->h, it->item->block->w, h));
+#endif
      }
 }
 
index a71478e..f9c4c83 100644 (file)
@@ -204,6 +204,7 @@ struct _Elm_Genlist_Data
    /**< value whether item loop feature is enabled or not. */
    Eina_Bool                             item_loop_enable : 1;
    Eina_Bool                             item_looping_on : 1;
+   Eina_List                             *prepend_items;
 };
 
 typedef struct _Item_Block Item_Block;