PagedList.Builder

public final class PagedList.Builder<Key extends Object, Value extends Object>


Builder class for PagedList.

pagingSource, config, notifyDispatcher and fetchDispatcher must all be provided.

A PagedList queries initial data from its PagingSource during construction, to avoid empty PagedLists being presented to the UI when possible. It's preferred to present initial data, so that the UI doesn't show an empty list, or placeholders for a few frames, just before showing initial content.

LivePagedListBuilder does this creation on a background thread automatically, if you want to receive a LiveData<PagedList<...>>.

Parameters
<Key extends Object>

Type of key used to load data from the PagingSource.

<Value extends Object>

Type of items held and loaded by the PagedList.

Summary

Public constructors

<Key extends Object, Value extends Object> Builder(
    DataSource<Key, Value> dataSource,
    PagedList.Config config
)

Create a Builder with the provided DataSource and Config.

<Key extends Object, Value extends Object> Builder(
    DataSource<Key, Value> dataSource,
    int pageSize
)

Create a PagedList.Builder with the provided DataSource and pageSize.

<Key extends Object, Value extends Object> Builder(
    PagingSource<Key, Value> pagingSource,
    PagingSource.LoadResult.Page<Key, Value> initialPage,
    PagedList.Config config
)

Create a PagedList.Builder with the provided PagingSource, initial PagingSource.LoadResult.Page, and PagedList.Config.

<Key extends Object, Value extends Object> Builder(
    PagingSource<Key, Value> pagingSource,
    PagingSource.LoadResult.Page<Key, Value> initialPage,
    int pageSize
)

Create a PagedList.Builder with the provided PagingSource, initial PagingSource.LoadResult.Page, and