ListUpdateCallback


public 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 methods

abstract void
onChanged(int position, int count, @Nullable Object payload)

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

abstract void
onInserted(int position, int count)

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

abstract void
onMoved(int fromPosition, int toPosition)

Called when an item changes its position in the list.

abstract void
onRemoved(int position, int count)

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

Public methods

onChanged

Added in 1.0.0
abstract void onChanged(int position, int count, @Nullable Object payload)

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

Parameters
int position

The position of the item which has been updated.

int count

The number of items which has changed.

@Nullable Object payload

The payload for the changed items.

onInserted

Added in 1.0.0
abstract void onInserted(int position, int count)

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

Parameters
int position

The position of the new item.

int count

The number of items that have been added.

onMoved

Added in 1.0.0
abstract void onMoved(int fromPosition, int toPosition)

Called when an item changes its position in the list.

Parameters
int fromPosition

The previous position of the item before the move.

int toPosition

The new position of the item.

onRemoved

Added in 1.0.0
abstract void onRemoved(int position, int count)

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

Parameters
int position

The position of the item which has been removed.

int count

The number of items which have been removed.