ObjectAdapter
abstract class ObjectAdapter
kotlin.Any | |
↳ | androidx.leanback.widget.ObjectAdapter |
Base class adapter to be used in leanback activities. Provides access to a data model and is decoupled from the presentation of the items via PresenterSelector
.
Summary
Nested classes | |
---|---|
abstract |
A DataObserver can be notified when an ObjectAdapter's underlying data changes. |
Constants | |
---|---|
static Int |
Indicates that an id has not been set. |
Public constructors | |
---|---|
<init>(presenterSelector: PresenterSelector!) Constructs an adapter with the given |
|
Constructs an adapter that uses the given |
|
<init>() Constructs an adapter. |
Public methods | |
---|---|
abstract Any! |
Returns the item for the given position. |
open Long |
Returns the id for the given position. |
Presenter! |
getPresenter(item: Any!) Returns the |
PresenterSelector! |
Returns the presenter selector for this ObjectAdapter. |
Boolean |
Returns true if the item ids are stable across changes to the underlying data. |
open Boolean |
Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise. |
Unit |
notifyItemRangeChanged(positionStart: Int, itemCount: Int) Notifies UI that some items has changed. |
Unit |
notifyItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any!) Notifies UI that some items has changed. |
Unit |
registerObserver(observer: ObjectAdapter.DataObserver!) Registers a DataObserver for data change notifications. |
Unit |
setHasStableIds(hasStableIds: Boolean) Sets whether the item ids are stable across changes to the underlying data. |
Unit |
setPresenterSelector(presenterSelector: PresenterSelector!) Sets the presenter selector. |
abstract Int |
size() Returns the number of items in the adapter. |
Unit |
Unregisters all DataObservers for this ObjectAdapter. |
Unit |
unregisterObserver(observer: ObjectAdapter.DataObserver!) Unregisters a DataObserver for data change notifications. |
Protected methods | |
---|---|
Unit |
Notifies UI that the underlying data has changed. |
Unit |
notifyItemMoved(fromPosition: Int, toPosition: Int) Notifies UI that item at fromPosition has been moved to toPosition. |
Unit |
notifyItemRangeInserted(positionStart: Int, itemCount: Int) Notifies UI that new items has been inserted. |
Unit |
notifyItemRangeRemoved(positionStart: Int, itemCount: Int) Notifies UI that some items that has been removed. |
open Unit |
Called when |
open Unit |