BatchingListUpdateCallback

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

For instance, when 2 add operations comes that adds 2 consecutive elements, BatchingListUpdateCallback merges them and calls the wrapped callback only once.

This is a general purpose class and is also used by DiffResult and SortedList to minimize the number of updates that are dispatched.

If you use this class to batch updates, you must call dispatchLastEvent when the stream of update events drain.

Constructors

Link copied to clipboard
constructor(@NonNull callback: ListUpdateCallback)

Functions

Link copied to clipboard
BatchingListUpdateCallback holds onto the last event to see if it can be merged with the next one.
Link copied to clipboard
open fun onChanged(position: Int, count: Int, payload: Any)
Called when count} number of items are updated at the given position.
Link copied to clipboard
open fun onInserted(position: Int, count: Int)
Called when count} number of items are inserted at the given position.
Link copied to clipboard
open fun onMoved(fromPosition: Int, toPosition: Int)
Called when an item changes its position in the list.
Link copied to clipboard
open fun onRemoved(position: Int, count: Int)
Called when count} number of items are removed from the given position.