if (scrollAnimationNeeded)
{
RemoveAnimation(mScrollAnimation);
- mScrollAnimation = Animation::New(mAnchoringDuration);
+ 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.Play();
if( removeIter != mItemPool.end() )
{
- Self().Remove( removeIter->second );
+ ReleaseActor(itemId, removeIter->second);
+
removed = true;
// Adjust the remaining item IDs, for example if item 2 is removed:
const ItemPoolIter iter = mItemPool.find( replacementItem.first );
if( mItemPool.end() != iter )
{
- Self().Remove( iter->second );
+ ReleaseActor(iter->first, iter->second);
iter->second = replacementItem.second;
}
else
if( ! range.Within( current ) )
{
- Self().Remove( iter->second );
+ ReleaseActor(iter->first, iter->second);
mItemPool.erase( iter++ ); // erase invalidates the return value of post-increment; iter remains valid
}
}
}
+void ItemView::ReleaseActor( ItemId item, Actor actor )
+{
+ Self().Remove( actor );
+ mItemFactory.ItemReleased(item, actor);
+}
+
ItemRange ItemView::GetItemRange(ItemLayout& layout, const Vector3& layoutSize, float layoutPosition, bool reserveExtra)
{
unsigned int itemCount = mItemFactory.GetNumberOfItems();
*/
void SetupActor( Item item, float durationSeconds );
+ /**
+ * Remove the Actor from the ItemPool and notify the ItemFactory the actor has been released by ItemView.
+ * @param[in] item The ID for the item to be released.
+ * @param[in] actor The actor to be removed from ItemView.
+ */
+ void ReleaseActor( ItemId item, Actor actor );
+
private: // From CustomActorImpl
/**
{
/**
- * @brief ItemFactory is an abstract interface for providing actors to ItemView.
+ * @brief ItemFactory is for providing actors to ItemView.
* Each actor is identified by a unique ID, and has a linear order from 0 to GetNumberOfItems()-1.
*/
class ItemFactory
* @return An actor, or an uninitialized pointer if the ID is out of range.
*/
virtual Actor NewItem(unsigned int itemId) = 0;
+
+ /**
+ * @brief Notify the factory the actor representing the item is removed from ItemView.
+ *
+ * @param[in] itemId The ID of the released item.
+ * @param[in] actor The actor that represents the released item.
+ */
+ virtual void ItemReleased(unsigned int itemId, Actor actor) {};
};
} // namespace Toolkit