RxPagedListBuilder

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


Builder for Observable<PagedList> or Flowable<PagedList>, given a DataSource.Factory and a 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).

The returned observable/flowable will already be subscribed on the setFetchScheduler, and will perform all loading on that scheduler. It will already be observed on setNotifyScheduler, and will dispatch new PagedLists, as well as their updates to that scheduler.

Parameters
<Key extends Object>

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

<Value extends Object>

Item type being presented.

Summary

Public constructors

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

Creates a RxPagedListBuilder with required parameters.

<Key extends Object, Value extends Object> RxPagedListBuilder(
    Function0<PagingSource<Key, Value>> pagingSourceFactory,
    int pageSize
)

Creates a RxPagedListBuilder with required parameters.

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

Creates a RxPagedListBuilder with required parameters.

<Key extends Object, Value extends Object> RxPagedListBuilder(
    DataSource.Factory<Key, Value> dataSourceFactory,
    int pageSize
)

Creates a RxPagedListBuilder with required parameters.

Public methods

final @NonNull Flowable<@NonNull PagedList<@NonNull Value>>
buildFlowable(BackpressureStrategy backpressureStrategy)

Constructs a Flowable<PagedList>.

final @NonNull Observable<@NonNull PagedList<@NonNull Value>>

Constructs a Observable<PagedList>.

final @NonNull RxPagedListBuilder<@NonNull Key, @NonNull Value>
setBoundaryCallback(
    PagedList.BoundaryCallback<Value> boundaryCallback
)

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 RxPagedListBuilder<@NonNull Key, @NonNull Value>

Sets scheduler which will be used for background fetching of PagedLists, as well as on-demand fetching of pages inside.

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

First loading key passed to the first PagedList/DataSource.

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

Sets scheduler which will be used for observing new PagedLists, as well as loading updates within the PagedLists.

Public constructors

RxPagedListBuilder

public final <Key extends Object, Value extends Object> RxPagedListBuilder(
    Function0<PagingSource<Key, Value>> pagingSourceFactory,
    PagedList.Config config
)

Creates a RxPagedListBuilder with required parameters.

Parameters
Function0<PagingSource<Key, Value>> pagingSourceFactory

DataSource factory providing DataSource generations.

PagedList.Config config

Paging configuration.

RxPagedListBuilder

public final <Key extends Object, Value extends Object> RxPagedListBuilder(
    Function0<PagingSource<Key, Value>> pagingSourceFactory,
    int pageSize
)

Creates a RxPagedListBuilder with required parameters.

This method is a convenience for:

RxPagedListBuilder(
pagingSourceFactory,
PagedList.Config.Builder().setPageSize(pageSize).build()
)
Parameters
Function0<PagingSource<Key, Value>> pagingSourceFactory

PagingSource factory providing PagingSource generations.

int pageSize

Size of pages to load.

RxPagedListBuilder

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

Creates a RxPagedListBuilder with required parameters.

Parameters
DataSource.Factory<Key, Value> dataSourceFactory

DataSource factory providing DataSource generations.

PagedList.Config config

Paging configuration.

RxPagedListBuilder

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

Creates a RxPagedListBuilder with required parameters.

This method is a convenience for:

RxPagedListBuilder(
dataSourceFactory,
PagedList.Config.Builder().setPageSize(pageSize).build()
)
Parameters
DataSource.Factory<Key, Value> dataSourceFactory

DataSource.Factory providing DataSource generations.

int pageSize

Size of pages to load.

Public methods