ObjectAdapter.DataObserver


public abstract class ObjectAdapter.DataObserver


A DataObserver can be notified when an ObjectAdapter's underlying data changes. Separate methods provide notifications about different types of changes.

Summary

Public constructors

Public methods

void

Called whenever the ObjectAdapter's data has changed in some manner outside of the set of changes covered by the other range-based change notification methods.

void
onItemMoved(int fromPosition, int toPosition)

Called when an item is moved from one position to another position

void
onItemRangeChanged(int positionStart, int itemCount)

Called when a range of items in the ObjectAdapter has changed.

void
onItemRangeChanged(
    int positionStart,
    int itemCount,
    @Nullable Object payload
)

Called when a range of items in the ObjectAdapter has changed.

void
onItemRangeInserted(int positionStart, int itemCount)

Called when a range of items is inserted into the ObjectAdapter.

void
onItemRangeRemoved(int positionStart, int itemCount)

Called when a range of items is removed from the ObjectAdapter.

Public constructors

DataObserver

Added in 1.1.0
public DataObserver()

Public methods

onChanged

Added in 1.1.0
public void onChanged()

Called whenever the ObjectAdapter's data has changed in some manner outside of the set of changes covered by the other range-based change notification methods.

onItemMoved

Added in 1.1.0
public void onItemMoved(int fromPosition, int toPosition)

Called when an item is moved from one position to another position

Parameters
int fromPosition

Previous position of the item.

int toPosition

New position of the item.

onItemRangeChanged

Added in 1.1.0
public void onItemRangeChanged(int positionStart, int itemCount)

Called when a range of items in the ObjectAdapter has changed. The basic ordering and structure of the ObjectAdapter has not changed.

Parameters
int positionStart

The position of the first item that changed.

int itemCount

The number of items changed.

onItemRangeChanged

Added in 1.1.0
public void onItemRangeChanged(
    int positionStart,
    int itemCount,
    @Nullable Object payload
)

Called when a range of items in the ObjectAdapter has changed. The basic ordering and structure of the ObjectAdapter has not changed.

Parameters
int positionStart

The position of the first item that changed.

int itemCount

The number of items changed.

@Nullable Object payload

Optional parameter, use null to identify a "full" update.

onItemRangeInserted

Added in 1.1.0
public void onItemRangeInserted(int positionStart, int itemCount)

Called when a range of items is inserted into the ObjectAdapter.

Parameters
int positionStart

The position of the first inserted item.

int itemCount

The number of items inserted.

onItemRangeRemoved

Added in 1.1.0
public void onItemRangeRemoved(int positionStart, int itemCount)

Called when a range of items is removed from the ObjectAdapter.

Parameters
int positionStart

The position of the first removed item.

int itemCount

The number of items removed.