ListUpdateCallback
public
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
void
|
onChanged(int position, int count, Object payload)
Called when |
abstract
void
|
onInserted(int position, int count)
Called when |
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 |
Public methods
onChanged
public abstract void onChanged (int position, int count, Object payload)
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 |
Object |
onInserted
public abstract void onInserted (int position, int count)
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
public abstract void onMoved (int fromPosition, int toPosition)
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
public abstract void onRemoved (int position, int count)
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.
|