SparseArrayObjectAdapter
class SparseArrayObjectAdapter : ObjectAdapter
kotlin.Any | ||
↳ | androidx.leanback.widget.ObjectAdapter | |
↳ | androidx.leanback.widget.SparseArrayObjectAdapter |
An ObjectAdapter
implemented with a android.util.SparseArray
. This class maintains an array of objects where each object is associated with an integer key which determines its order relative to other objects.
Summary
Public constructors |
---|
Constructs an adapter. |
SparseArrayObjectAdapter(presenter: Presenter!) Constructs an adapter with the given |
SparseArrayObjectAdapter(presenterSelector: PresenterSelector!) Constructs an adapter with the given |
Public functions |
|
---|---|
Unit |
clear() Removes all items from this adapter, leaving it empty. |
Unit |
Clears the given key and associated item from the adapter. |
Any? |
Returns the item for the given position. |
Int |
Returns the index for the given item in the adapter. |
Int |
Returns the index for the given key in the adapter. |
Boolean |
Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise. |
Any! |
Returns the object for the given key, or null if no mapping for that key exists. |
Unit |
notifyArrayItemRangeChanged(positionStart: Int, itemCount: Int) Notify that the content of a range of items changed. |
Unit |
Sets the item for the given key. |
Int |
size() Returns the number of items in the adapter. |
Inherited functions |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
SparseArrayObjectAdapter
SparseArrayObjectAdapter(presenter: Presenter!)
Constructs an adapter with the given Presenter
.
SparseArrayObjectAdapter
SparseArrayObjectAdapter(presenterSelector: PresenterSelector!)
Constructs an adapter with the given PresenterSelector
.
Public functions
clear
fun clear(key: Int): Unit
Clears the given key and associated item from the adapter.
Parameters | |
---|---|
key: Int |
The key to be cleared. |
indexOf
fun indexOf(item: Any!): Int
Returns the index for the given item in the adapter.
Parameters | |
---|---|
item: Any! |
The item to find in the array. |
Returns | |
---|---|
Int |
Index of the item, or a negative value if not found. |
indexOf
fun indexOf(key: Int): Int
Returns the index for the given key in the adapter.
Parameters | |
---|---|
key: Int |
The key to find in the array. |
Returns | |
---|---|
Int |
Index of the item, or a negative value if not found. |
isImmediateNotifySupported
fun isImmediateNotifySupported(): Boolean
Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise.
lookup
fun lookup(key: Int): Any!
Returns the object for the given key, or null if no mapping for that key exists.
notifyArrayItemRangeChanged
fun notifyArrayItemRangeChanged(positionStart: Int, itemCount: Int): Unit
Notify that the content of a range of items changed. Note that this is not same as items being added or removed.