DataObserver
abstract class DataObserver
kotlin.Any | |
↳ | androidx.leanback.widget.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 | |
---|---|
<init>() A DataObserver can be notified when an ObjectAdapter's underlying data changes. |
Public methods | |
---|---|
open 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. |
open Unit |
onItemMoved(fromPosition: Int, toPosition: Int) Called when an item is moved from one position to another position |
open Unit |
onItemRangeChanged(positionStart: Int, itemCount: Int) Called when a range of items in the ObjectAdapter has changed. |
open Unit |
onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any!) Called when a range of items in the ObjectAdapter has changed. |
open Unit |
onItemRangeInserted(positionStart: Int, itemCount: Int) Called when a range of items is inserted into the ObjectAdapter. |
open Unit |
onItemRangeRemoved(positionStart: Int, itemCount: Int) Called when a range of items is removed from the ObjectAdapter. |
Public constructors
<init>
DataObserver()
A DataObserver can be notified when an ObjectAdapter's underlying data changes. Separate methods provide notifications about different types of changes.
Public methods
onChanged
open 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
open 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
open 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
open 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
open 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. |