ListUpdateCallback
interface ListUpdateCallback
androidx.recyclerview.widget.ListUpdateCallback |
An interface that can receive Update operations that are applied to a list.
This class can be used together with DiffUtil to detect changes between two lists.
Summary
Public methods | |
---|---|
abstract Unit |
Called when |
abstract Unit |
onInserted(position: Int, count: Int) Called when |
abstract Unit |
Called when an item changes its position in the list. |
abstract Unit |
Called when |
Public methods
onChanged
abstract fun onChanged(
position: Int,
count: Int,
@Nullable payload: Any?
): Unit
Called when count
number of items are updated at the given position.
Parameters | |
---|---|
position |
Int: The position of the item which has been updated. |
count |
Int: The number of items which has changed. |
onInserted
abstract fun onInserted(
position: Int,
count: Int
): Unit
Called when count
number of items are inserted at the given position.
Parameters | |
---|---|
position |
Int: The position of the new item. |
count |
Int: The number of items that have been added. |
onMoved
abstract fun onMoved(
fromPosition: Int,
toPosition: Int
): Unit
Called when an item changes its position in the list.
Parameters | |
---|---|
fromPosition |
Int: The previous position of the item before the move. |
toPosition |
Int: The new position of the item. |