CursorObjectAdapter

open class CursorObjectAdapter : ObjectAdapter
kotlin.Any
   ↳ androidx.leanback.widget.ObjectAdapter
   ↳ androidx.leanback.widget.CursorObjectAdapter

An ObjectAdapter implemented with a Cursor.

Summary

Inherited constants

Public constructors

<init>(presenterSelector: PresenterSelector!)

Constructs an adapter with the given PresenterSelector.

<init>(presenter: Presenter!)

Constructs an adapter that uses the given Presenter for all items.

Constructs an adapter.

Public methods

open Unit
changeCursor(cursor: Cursor!)

Changes the underlying cursor to a new cursor.

open Unit

Closes this adapter, closing the backing Cursor as well.

open Any!
get(index: Int)

Cursor!

Returns the Cursor backing the adapter.

CursorMapper!

Returns the CursorMapper used to convert Cursor rows into Objects.

open Boolean

Returns true if the adapter, and hence the backing Cursor, is closed; false otherwise.

open Boolean

Unit

Sets the CursorMapper used to convert Cursor rows into Objects.

open Int

open Cursor!
swapCursor(cursor: Cursor!)

Swap in a new Cursor, returning the old Cursor.

Protected methods

Unit

Removes an item from the cache.

Unit
invalidateCache(index: Int, count: Int)

Removes count items starting at index.

open Unit

Called whenever the cursor changes.

open Unit

Called when setMapper(CursorMapper) is called and a different mapper is provided.

Inherited functions

Public constructors

<init>

CursorObjectAdapter(presenterSelector: PresenterSelector!)

Constructs an adapter with the given PresenterSelector.

<init>

CursorObjectAdapter(presenter: Presenter!)

Constructs an adapter that uses the given Presenter for all items.

<init>

CursorObjectAdapter()

Constructs an adapter.

Public methods

changeCursor

open fun changeCursor(cursor: Cursor!): Unit

Changes the underlying cursor to a new cursor. If there is an existing cursor it will be closed if it is different than the new cursor.

Parameters
cursor Cursor!: The new cursor to be used.

close

open fun close(): Unit

Closes this adapter, closing the backing Cursor as well.

get

open fun get(index: Int): Any!

getCursor

fun getCursor(): Cursor!

Returns the Cursor backing the adapter.

getMapper

fun getMapper(): CursorMapper!

Returns the CursorMapper used to convert Cursor rows into Objects.

isClosed

open fun isClosed(): Boolean

Returns true if the adapter, and hence the backing Cursor, is closed; false otherwise.

isImmediateNotifySupported

open fun isImmediateNotifySupported(): Boolean

setMapper

fun setMapper(mapper: CursorMapper!): Unit

Sets the CursorMapper used to convert Cursor rows into Objects.

size

open fun size(): Int

swapCursor

open fun swapCursor(cursor: Cursor!): Cursor!

Swap in a new Cursor, returning the old Cursor. Unlike changeCursor(Cursor), the returned old Cursor is not closed.

Parameters
cursor Cursor!: The new cursor to be used.

Protected methods

invalidateCache

protected fun invalidateCache(index: Int): Unit

Removes an item from the cache. This will force the item to be re-read from the data source the next time get(int) is called.

invalidateCache

protected fun invalidateCache(index: Int, count: Int): Unit

Removes count items starting at index.

onCursorChanged

protected open fun onCursorChanged(): Unit

Called whenever the cursor changes.

onMapperChanged

protected open fun onMapperChanged(): Unit

Called when setMapper(CursorMapper) is called and a different mapper is provided.