BatchingListUpdateCallback

open class BatchingListUpdateCallback : ListUpdateCallback
kotlin.Any
   ↳ androidx.recyclerview.widget.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.

Summary

Public constructors

<init>(@NonNull callback: ListUpdateCallback)

Public methods

open Unit

BatchingListUpdateCallback holds onto the last event to see if it can be merged with the next one.

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

open Unit
onInserted(position: Int, count: Int)

open Unit
onMoved(fromPosition: Int, toPosition: Int)

open Unit
onRemoved(position: Int, count: Int)

Public constructors

<init>

BatchingListUpdateCallback(@NonNull callback: ListUpdateCallback)

Public methods

dispatchLastEvent

open fun dispatchLastEvent(): Unit

BatchingListUpdateCallback holds onto the last event to see if it can be merged with the next one. When stream of events finish, you should call this method to dispatch the last event.

onChanged

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

onInserted

open fun onInserted(position: Int, count: Int): Unit

onMoved

open fun onMoved(fromPosition: Int, toPosition: Int): Unit

onRemoved

open fun onRemoved(position: Int, count: Int): Unit