ObjectAdapter.DataObserver

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 functions

Unit

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.

Unit
onItemMoved(fromPosition: Int, toPosition: Int)

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

Unit
onItemRangeChanged(positionStart: Int, itemCount: Int)

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

Unit
onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any?)

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

Unit
onItemRangeInserted(positionStart: Int, itemCount: Int)

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

Unit
onItemRangeRemoved(positionStart: Int, itemCount: Int)

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

Public constructors

DataObserver

Added in 1.1.0
DataObserver()

Public functions

onChanged

Added in 1.1.0
fun onChanged(): Unit

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
fun onItemMoved(fromPosition: Int, toPosition: Int): Unit

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

Parameters
fromPosition: Int

Previous position of the item.

toPosition: Int

New position of the item.

onItemRangeChanged

Added in 1.1.0
fun onItemRangeChanged(positionStart: Int, itemCount: Int): Unit

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

Parameters
positionStart: Int

The position of the first item that changed.

itemCount: Int

The number of items changed.

onItemRangeChanged

Added in 1.1.0
fun onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any?): Unit

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

Parameters
positionStart: Int

The position of the first item that changed.

itemCount: Int

The number of items changed.

payload: Any?

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

onItemRangeInserted

Added in 1.1.0
fun onItemRangeInserted(positionStart: Int, itemCount: Int): Unit

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

Parameters
positionStart: Int

The position of the first inserted item.

itemCount: Int

The number of items inserted.

onItemRangeRemoved

Added in 1.1.0
fun onItemRangeRemoved(positionStart: Int, itemCount: Int): Unit

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

Parameters
positionStart: Int

The position of the first removed item.

itemCount: Int

The number of items removed.