ListUpdateCallback


interface ListUpdateCallback

Known direct subclasses
AdapterListUpdateCallback

ListUpdateCallback that dispatches update events to the given adapter.

BatchingListUpdateCallback

Wraps a ListUpdateCallback callback and batches operations that can be merged.

SortedList.Callback

The class that controls the behavior of the SortedList.

Known indirect subclasses
SortedList.BatchedCallback

A callback implementation that can batch notify events dispatched by the SortedList.

SortedListAdapterCallback

A SortedList.Callback implementation that can bind a SortedList to a RecyclerView.Adapter.


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 functions

Unit
onChanged(position: Int, count: Int, payload: Any?)

Called when count number of items are updated at the given position.

Unit
onInserted(position: Int, count: Int)

Called when count number of items are inserted at the given position.

Unit
onMoved(fromPosition: Int, toPosition: Int)

Called when an item changes its position in the list.

Unit
onRemoved(position: Int, count: Int)

Called when count number of items are removed from the given position.

Public functions

onChanged

Added in 1.0.0
fun onChanged(position: Int, count: Int, 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.

payload: Any?

The payload for the changed items.

onInserted

Added in 1.0.0
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

Added in 1.0.0
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.

onRemoved

Added in 1.0.0
fun onRemoved(position: Int, count: Int): Unit

Called when count number of items are removed from the given position.

Parameters
position: Int

The position of the item which has been removed.

count: Int

The number of items which have been removed.