static bool gObjectCreatedCallBackCalled;
static bool gOnLayoutActivatedCalled; ///< Whether the LayoutActivated signal was invoked.
-static bool gOnScrollUpdateCalled;
static void TestCallback(BaseHandle handle)
{
gOnLayoutActivatedCalled = true;
}
-static void OnScrollUpdate( const Vector2& position )
-{
- gOnScrollUpdateCalled = true;
-}
-
// Generate a PanGestureEvent to send to Core
Integration::PanGestureEvent GeneratePan(
Gesture::State state,
END_TEST;
}
-
-int UtcDaliItemEnableDisableRefresh(void)
-{
- ToolkitTestApplication application;
- Dali::Stage stage = Dali::Stage::GetCurrent();
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
-
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
- stage.Add(view);
-
- // Activate the grid layout so that the items will be created and added to ItemView
- Vector3 stageSize(stage.GetSize());
- view.ActivateLayout(0, stageSize, 0.5f);
-
- //Connect to signal scroll updated
- view.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
-
- Property::Map attributes;
- view.DoAction("enableRefresh", attributes );
- gOnScrollUpdateCalled = true;
- view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
- application.SendNotification();
- application.Render(1000);
- DALI_TEST_EQUALS( gOnScrollUpdateCalled, true, TEST_LOCATION );
-
-
- view.DoAction("disableRefresh", attributes );
- gOnScrollUpdateCalled = false;
- view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
- application.SendNotification();
- application.Render(1000);
-
- DALI_TEST_EQUALS( gOnScrollUpdateCalled, false, TEST_LOCATION );
-
- END_TEST;
-}
scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION );
scrollView.ScrollTo( target, 0.0f );
Wait(application, RENDER_DELAY_SCROLL);
scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION );
scrollView.ScrollTo( target, 0.0f );
Wait(application, RENDER_DELAY_SCROLL);
DALI_ACTION_REGISTRATION( Toolkit, ItemView, "stopScrolling", ACTION_STOP_SCROLLING )
-DALI_ACTION_REGISTRATION( Toolkit, ItemView, "enableRefresh", ACTION_ENABLE_REFRESH )
-DALI_ACTION_REGISTRATION( Toolkit, ItemView, "disableRefresh", ACTION_DISABLE_REFRESH )
-
DALI_TYPE_REGISTRATION_END()
bool FindById( const ItemContainer& items, ItemId id )
mIsFlicking(false),
mAddingItems(false),
mRefreshEnabled(true),
- mRefreshNotificationEnabled(true),
mInAnimation(false)
{
}
void ItemView::OnRefreshNotification(PropertyNotification& source)
{
- if( mRefreshNotificationEnabled )
+ // Cancel scroll animation to prevent any fighting of setting the scroll position property by scroll bar during fast scroll.
+ 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)
- {
- RemoveAnimation(mScrollAnimation);
- }
-
- // Only cache extra items when it is not a fast scroll
- DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation);
+ RemoveAnimation(mScrollAnimation);
}
+
+ // Only cache extra items when it is not a fast scroll
+ DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation);
}
void ItemView::Refresh()
{
GetImpl( itemView ).DoStopScrolling();
}
- else if ( 0 == strcmp( actionName.c_str(), ACTION_ENABLE_REFRESH ) )
- {
- GetImpl( itemView ).SetRefreshNotificationEnabled( true );
- }
- else if ( 0 == strcmp( actionName.c_str(), ACTION_DISABLE_REFRESH ) )
- {
- GetImpl( itemView ).SetRefreshNotificationEnabled( false );
- }
return true;
}
}
}
-void ItemView::SetRefreshNotificationEnabled( bool enabled )
-{
- mRefreshNotificationEnabled = enabled;
-}
-
} // namespace Internal
} // namespace Toolkit
*/
void DoStopScrolling();
- /**
- * Helper for DoAction( ACTION_ENABLE/DISABLE_REFRESH_NOTIFICATIONS ).
- * @param[in] enabled Whether to disable refresh notifications or not.
- */
- void SetRefreshNotificationEnabled( bool enabled );
-
private:
/**
bool mIsFlicking : 1;
bool mAddingItems : 1;
bool mRefreshEnabled : 1; ///< Whether to refresh the cache automatically
- bool mRefreshNotificationEnabled : 1; ///< Whether to disable refresh notifications or not.
bool mInAnimation : 1; ///< Keeps track of whether an animation is controlling the overshoot property.
};
// Position Delta ///////////////////////////////////////////////////////
if(positionChanged)
{
- UpdateMainInternalConstraint();
if(mWrapMode && findShortcuts)
{
// In Wrap Mode, the shortest distance is a little less intuitive...