LivePagedListBuilder

public final class LivePagedListBuilder<Key extends Object, Value extends Object>


Builder for LiveData<PagedList> for Java users, given a androidx.paging.DataSource.Factory and a androidx.paging.PagedList.Config.

The required parameters are in the constructor, so you can simply construct and build, or optionally enable extra features (such as initial load key, or BoundaryCallback).

Parameters
<Key extends Object>

Type of input valued used to load data from the DataSource. Must be Int if you're using PositionalDataSource.

<Value extends Object>

Item type being presented.

See also
toLiveData

Summary

Public constructors

<Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    @NonNull PagedList.Config config
)

Creates a LivePagedListBuilder with required parameters.

<Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    int pageSize
)

Creates a LivePagedListBuilder with required parameters.

<Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory,
    @NonNull PagedList.Config config
)

Creates a LivePagedListBuilder with required parameters.

<Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory,
    int pageSize
)

Creates a LivePagedListBuilder with required parameters.

Public methods

final @NonNull LiveData<@NonNull PagedList<@NonNull Value>>

Constructs the LiveData<PagedList>.

final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value>

Sets a androidx.paging.PagedList.BoundaryCallback on each PagedList created, typically used to load additional data from network when paging from local storage.

final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value>

Set the CoroutineScope that page loads should be launched within.

final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value>

Sets Executor used for background fetching of PagedLists, and the pages within.

final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value>

First loading key passed to the first PagedList/DataSource.

Public constructors

LivePagedListBuilder

public final <Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    @NonNull PagedList.Config config
)

Creates a LivePagedListBuilder with required parameters.

Parameters
@NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory

DataSource factory providing DataSource generations.

@NonNull PagedList.Config config

Paging configuration.

LivePagedListBuilder

public final <Key extends Object, Value extends Object> LivePagedListBuilder(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    int pageSize
)

Creates a LivePagedListBuilder with required parameters.

This method is a convenience for:

LivePagedListBuilder(dataSourceFactory,
new PagedList.Config.Builder().setPageSize(pageSize).build())
Parameters
@