Allow configurable refresh interval in ItemView during fast scroll 89/44289/1
authorRichard Huang <r.huang@samsung.com>
Mon, 20 Jul 2015 15:08:24 +0000 (16:08 +0100)
committerRichard Huang <r.huang@samsung.com>
Mon, 20 Jul 2015 15:08:24 +0000 (16:08 +0100)
Change-Id: I1459b344c9b2315b9a86fc91a92b600509153fdf

dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h

index c70b792..c4d2840 100644 (file)
@@ -457,11 +457,14 @@ void ItemView::DeactivateCurrentLayout()
 
 void ItemView::OnRefreshNotification(PropertyNotification& source)
 {
-  if(mRefreshEnabled || mScrollAnimation)
+  // Cancel scroll animation to prevent any fighting of setting the scroll position property by scroll bar during fast scroll.
+  if(!mRefreshEnabled && mScrollAnimation)
   {
-    // Only refresh the cache during normal scrolling
-    DoRefresh(GetCurrentLayoutPosition(0), true);
+    RemoveAnimation(mScrollAnimation);
   }
+
+  // Only cache extra items when it is not a fast scroll
+  DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation);
 }
 
 void ItemView::Refresh()
@@ -957,7 +960,6 @@ void ItemView::OnChildAdd(Actor& child)
                                         Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y,
                                         Toolkit::Scrollable::Property::SCROLL_POSITION_MAX_Y,
                                         Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE);
-      scrollBar.ScrollPositionIntervalReachedSignal().Connect( this, &ItemView::OnScrollPositionChanged );
     }
   }
 }
@@ -1625,18 +1627,6 @@ void ItemView::GetItemsRange(ItemRange& range)
   }
 }
 
-void ItemView::OnScrollPositionChanged( float position )
-{
-  // Cancel scroll animation to prevent any fighting of setting the scroll position property.
-  if(!mRefreshEnabled)
-  {
-    RemoveAnimation(mScrollAnimation);
-  }
-
-  // Refresh the cache immediately when the scroll position is changed.
-  DoRefresh(position, false); // No need to cache extra items.
-}
-
 bool ItemView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   Dali::BaseHandle handle( object );
index b6a2d96..9fc58aa 100644 (file)
@@ -559,12 +559,6 @@ private:
    */
   void OnRefreshNotification(PropertyNotification& source);
 
-  /**
-   * This is called when the change of scroll position is notified by ScrollBar.
-   * @param[in] position The new scroll position
-   */
-  void OnScrollPositionChanged( float position );
-
 private:
 
   ItemFactory& mItemFactory;