mAnimateOvershootOff(false),
mAnchoringEnabled(true),
mAnchoringDuration(DEFAULT_ANCHORING_DURATION),
- mRefreshIntervalLayoutPositions(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS),
+ mRefreshIntervalLayoutPositions(0.0f),
mRefreshOrderHint(true/*Refresh item 0 first*/),
mMinimumSwipeSpeed(DEFAULT_MINIMUM_SWIPE_SPEED),
mMinimumSwipeDistance(DEFAULT_MINIMUM_SWIPE_DISTANCE),
mMouseWheelEventFinishedTimer = Timer::New( MOUSE_WHEEL_EVENT_FINISHED_TIME_OUT );
mMouseWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnMouseWheelEventFinished );
- SetRefreshInterval(mRefreshIntervalLayoutPositions);
+ SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
}
ItemView::~ItemView()
{
DALI_ASSERT_ALWAYS(layoutIndex < mLayouts.size());
+ mRefreshEnabled = false;
+
Actor self = Self();
// The ItemView size should match the active layout size
}
// Refresh the new layout
- ItemRange range = GetItemRange(*mActiveLayout, targetSize, GetCurrentLayoutPosition(0), true/*reserve extra*/);
+ ItemRange range = GetItemRange(*mActiveLayout, targetSize, GetCurrentLayoutPosition(0), false/* don't reserve extra*/);
AddActorsWithinRange( range, durationSeconds );
// Scroll to an appropriate layout position
mScrollAnimation = Animation::New(durationSeconds);
mScrollAnimation.AnimateTo( Property( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ), firstItemScrollPosition, AlphaFunctions::EaseOut );
mScrollAnimation.AnimateTo( Property(self, mPropertyPosition), GetScrollPosition(firstItemScrollPosition, targetSize), AlphaFunctions::EaseOut );
+ mScrollAnimation.FinishedSignal().Connect(this, &ItemView::OnLayoutActivationScrollFinished);
mScrollAnimation.Play();
}
void ItemView::SetRefreshInterval(float intervalLayoutPositions)
{
- mRefreshIntervalLayoutPositions = intervalLayoutPositions;
-
- if(mRefreshNotification)
+ if(mRefreshIntervalLayoutPositions != intervalLayoutPositions)
{
- mScrollPositionObject.RemovePropertyNotification(mRefreshNotification);
+ mRefreshIntervalLayoutPositions = intervalLayoutPositions;
+
+ if(mRefreshNotification)
+ {
+ mScrollPositionObject.RemovePropertyNotification(mRefreshNotification);
+ }
+ mRefreshNotification = mScrollPositionObject.AddPropertyNotification( ScrollConnector::SCROLL_POSITION, StepCondition(mRefreshIntervalLayoutPositions, 0.0f) );
+ mRefreshNotification.NotifySignal().Connect( this, &ItemView::OnRefreshNotification );
}
- mRefreshNotification = mScrollPositionObject.AddPropertyNotification( ScrollConnector::SCROLL_POSITION, StepCondition(mRefreshIntervalLayoutPositions, 0.0f) );
- mRefreshNotification.NotifySignal().Connect( this, &ItemView::OnRefreshNotification );
}
float ItemView::GetRefreshInterval() const
mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
self.SetProperty(mPropertyPosition, GetScrollPosition(firstItemScrollPosition, layoutSize));
mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+ mRefreshEnabled = true;
}
if (mMouseWheelEventFinishedTimer.IsRunning())
case Gesture::Started: // Fall through
{
mTotalPanDisplacement = Vector2::ZERO;
+ mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+ mRefreshEnabled = true;
}
case Gesture::Continuing:
mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
self.SetProperty(mPropertyPosition, GetScrollPosition(firstItemScrollPosition, layoutSize));
- mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
mTotalPanDisplacement += gesture.displacement;
mScrollOvershoot = layoutPositionDelta - firstItemScrollPosition;
mScrollOvershoot = 0.0f;
}
+void ItemView::OnLayoutActivationScrollFinished(Animation& source)
+{
+ mRefreshEnabled = true;
+ DoRefresh(GetCurrentLayoutPosition(0), true);
+}
+
void ItemView::OnOvershootOnFinished(Animation& animation)
{
mAnimatingOvershootOn = false;
}
mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+ mRefreshEnabled = true;
}
void ItemView::RemoveAnimation(Animation& animation)
}
mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+ mRefreshEnabled = true;
}
void ItemView::SetOvershootEffectColor( const Vector4& color )