LivePagedListKt

Added in 2.1.0

public final class LivePagedListKt


Summary

Public methods

static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>>
<Key extends Object, Value extends Object> toLiveData(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)

This method is deprecated. PagedList is deprecated and has been replaced by PagingData

static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>>
<Key extends Object, Value extends Object> toLiveData(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)

This method is deprecated. PagedList is deprecated and has been replaced by PagingData

static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>>
<Key extends Object, Value extends Object> toLiveData(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)

This method is deprecated. PagedList is deprecated and has been replaced by PagingData

static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>>
<Key extends Object, Value extends Object> toLiveData(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)

This method is deprecated. PagedList is deprecated and has been replaced by PagingData

Public methods

toLiveData

public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> toLiveData(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)

Constructs a LiveData<PagedList>, from this DataSource.Factory, convenience for LivePagedListBuilder.

No work (such as loading) is done immediately, the creation of the first PagedList is deferred until the LiveData is observed.

Parameters
@NonNull PagedList.Config config

Paging configuration.

Key initialLoadKey

Initial load key passed to the first PagedList / PagingSource.

PagedList.BoundaryCallback<@NonNull Value> boundaryCallback

The boundary callback for listening to PagedList load state.

@NonNull Executor fetchExecutor

Executor for fetching data from PagingSources.

toLiveData

public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> toLiveData(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)

Constructs a LiveData<PagedList>, from this DataSource.Factory, convenience for LivePagedListBuilder.

No work (such as loading) is done immediately, the creation of the first PagedList is deferred until the LiveData is observed.

Parameters
int pageSize

Page size.

Key initialLoadKey

Initial load key passed to the first PagedList / PagingSource.

PagedList.BoundaryCallback<@NonNull Value> boundaryCallback

The boundary callback for listening to PagedList load state.

@NonNull Executor fetchExecutor

Executor for fetching data from DataSources.

public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> toLiveData(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)

Constructs a LiveData<PagedList>, from this PagingSource factory, convenience for LivePagedListBuilder.

No work (such as loading) is done immediately, the creation of the first PagedList is deferred until the LiveData is observed.

Parameters
@NonNull PagedList.Config config

Paging configuration.

Key initialLoadKey

Initial load key passed to the first PagedList / PagingSource.

PagedList.BoundaryCallback<@NonNull Value> boundaryCallback

The boundary callback for listening to PagedList load state.

@NonNull CoroutineScope coroutineScope

Set the CoroutineScope that page loads should be launched within. The set coroutineScope allows a PagingSource to cancel running load operations when the results are no longer needed - for example, when the containing activity is destroyed.

Defaults to GlobalScope.

@NonNull CoroutineDispatcher fetchDispatcher

CoroutineDispatcher for fetching data from PagingSources.

public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> toLiveData(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)

Constructs a LiveData<PagedList>, from this PagingSource factory, convenience for LivePagedListBuilder.

No work (such as loading) is done immediately, the creation of the first PagedList is deferred until the LiveData is observed.

Parameters
int pageSize

Page size.

Key initialLoadKey

Initial load key passed to the first PagedList / PagingSource.

PagedList.BoundaryCallback<@NonNull Value> boundaryCallback

The boundary callback for listening to PagedList load state.

@NonNull CoroutineScope coroutineScope

Set the CoroutineScope that page loads should be launched within. The set coroutineScope allows a PagingSource to cancel running load operations when the results are no longer needed - for example, when the containing activity is destroyed.

Defaults to GlobalScope.

@NonNull CoroutineDispatcher fetchDispatcher

CoroutineDispatcher for fetching data from PagingSources.