PagingDataAdapter

public final class PagingDataAdapter<T extends Object> extends ObjectAdapter

Object
   ↳ ObjectAdapter
     ↳ PagingDataAdapter

An ObjectAdapter implemented with an AsyncPagingDataDiffer. It is an analogue of androidx.paging.PagingDataAdapter for leanback widgets.

Parameters
<T extends Object>

Type of the item in the list.

Summary

Public fields

final @NonNull Flow<@NonNull CombinedLoadStates>

A hot Flow of CombinedLoadStates that emits a snapshot whenever the loading state of the current PagingData changes.

Public constructors

<T extends Object> PagingDataAdapter(
    DiffUtil.ItemCallback<T> diffCallback,
    CoroutineDispatcher mainDispatcher,
    CoroutineDispatcher workerDispatcher
)

Constructs an adapter

<T extends Object> PagingDataAdapter(
    Presenter presenter,
    DiffUtil.ItemCallback<T> diffCallback,
    CoroutineDispatcher mainDispatcher,
    CoroutineDispatcher workerDispatcher
)

Constructs an adapter

<T extends Object> PagingDataAdapter(
    PresenterSelector presenterSelector,
    DiffUtil.ItemCallback<T> diffCallback,
    CoroutineDispatcher mainDispatcher,
    CoroutineDispatcher workerDispatcher
)

Constructs an adapter

Public methods

final void

Add a CombinedLoadStates listener to observe the loading state of the current PagingData.

T
get(int position)

Returns the item for the given position.

final T
peek(@IntRange(from = 0) int index)

Returns the presented item at the specified position, without notifying Paging of the item access that would normally trigger page loads.

final void

Refresh the data presented by this PagingDataAdapter.

final void

Remove a