PagingDataAdapter
class PagingDataAdapter<T : Any> : ObjectAdapter
kotlin.Any | ||
↳ | androidx.leanback.widget.ObjectAdapter | |
↳ | androidx.leanback.paging.PagingDataAdapter |
An ObjectAdapter implemented with an AsyncPagingDataDiffer. It is an analogue of androidx.paging.PagingDataAdapter for leanback widgets.
Summary
Public constructors | |
---|---|
<init>(diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default) Constructs an adapter |
|
<init>(presenter: Presenter, diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default) Constructs an adapter |
|
<init>(presenterSelector: PresenterSelector, diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default) Constructs an adapter |
Public methods | |
---|---|
Unit |
addLoadStateListener(listener: (CombinedLoadStates) -> Unit) Add a CombinedLoadStates listener to observe the loading state of the current PagingData. |
T? |
Returns the item for the given position. |
Unit |
refresh() Refresh the data presented by this PagingDataAdapter. |
Unit |
removeLoadStateListener(listener: (CombinedLoadStates) -> Unit) Remove a previously registered CombinedLoadStates listener. |
Unit |
retry() Retry any failed load requests that would result in a LoadState.Error update to this |
Int |
size() |
suspend Unit |
submitData(pagingData: PagingData<T>) Present a PagingData until it is invalidated by a call to refresh or PagingSource.invalidate. |
Unit |
submitData(lifecycle: Lifecycle, pagingData: PagingData<T>) Present a PagingData until it is either invalidated or another call to submitData is made. |
Inherited functions | |
---|---|
Properties | |
---|---|
Flow<CombinedLoadStates> |
A hot Flow of CombinedLoadStates that emits a snapshot whenever the loading state of the current PagingData changes. |
Public constructors
<init>
PagingDataAdapter(
diffCallback: DiffUtil.ItemCallback<T>,
mainDispatcher: CoroutineDispatcher = Dispatchers.Main,
workerDispatcher: CoroutineDispatcher = Dispatchers.Default)
Constructs an adapter
Parameters | |
---|---|
diffCallback: DiffUtil.ItemCallback<T> | The DiffUtil.ItemCallback instance to compare items in the list. |