Click or drag to resize

OSATParams, TItemViewsHolderOnItemIndexChangedDueInsertOrRemove Method

Called when an insert or remove event happens. You'll only need this if some of your views depend on the item's index itself as opposed to depending only on the model's data

For example, if your item is from a leaderboard and each player's place is given by the order of the models (i.e. you don't have an int in the model named 'place'), you may want to display the item's title as '#233 PlayerName'. This works well if you're only using ResetItems(Int32, Boolean, Boolean), but if you'll call InsertItems(Int32, Int32, Boolean, Boolean) or RemoveItems(Int32, Int32, Boolean, Boolean), the indices of some views holders are shifted, while they'll maintain their data. In this case, you'll override this method and only update the title from its model

This is an important optimization, because you shouldn't update items that are already updated, especially when fetching them from the web

Namespace:  Com.ForbiddenByte.OSA.Core
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
protected virtual void OnItemIndexChangedDueInsertOrRemove(
	TItemViewsHolder shiftedViewsHolder,
	int oldIndex,
	bool wasInsert,
	int removeOrInsertIndex
)

Parameters

shiftedViewsHolder
Type: TItemViewsHolder
The views holder associated with the item whose index was shifted
oldIndex
Type: SystemInt32
the item's old index
wasInsert
Type: SystemBoolean
true, if InsertItems(Int32, Int32, Boolean, Boolean) was called. false if RemoveItems(Int32, Int32, Boolean, Boolean) was called
removeOrInsertIndex
Type: SystemInt32
the index at which an insert or remove operation was made
Version Information

Optimized ScrollView Adapter

Supported in: 4.1
See Also