CombinedLoadStates

public final class CombinedLoadStates


Collection of pagination LoadStates for both a PagingSource, and RemoteMediator.

Note: The REFRESHLoadType.REFRESH always has LoadState.endOfPaginationReached set to false.

Summary

Public fields

final @NonNull LoadState

Convenience for combined behavior of APPENDLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

final @Nullable LoadStates

LoadStates corresponding to loads from a RemoteMediator, or null if RemoteMediator not present.

final @NonNull LoadState

Convenience for combined behavior of PREPENDLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

final @NonNull LoadState

Convenience for combined behavior of REFRESHLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

final @NonNull LoadStates

LoadStates corresponding to loads from a PagingSource.

Public constructors

CombinedLoadStates(
    @NonNull LoadState refresh,
    @NonNull LoadState prepend,
    @NonNull LoadState append,
    @NonNull LoadStates source,
    @Nullable LoadStates mediator
)

Public methods

boolean
int
@NonNull String

Public fields

append

@NonNull
public final @NonNull LoadState append

Convenience for combined behavior of APPENDLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

For use cases that require reacting to LoadState of source and mediator specifically, e.g., showing cached data when network loads via mediator fail, LoadStates exposed via source and mediator should be used directly.

mediator

@Nullable
public final @Nullable LoadStates mediator

LoadStates corresponding to loads from a RemoteMediator, or null if RemoteMediator not present.

prepend

@NonNull
public final @NonNull LoadState prepend

Convenience for combined behavior of PREPENDLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

For use cases that require reacting to LoadState of source and mediator specifically, e.g., showing cached data when network loads via mediator fail, LoadStates exposed via source and mediator should be used directly.

refresh

@NonNull
public final @NonNull LoadState refresh

Convenience for combined behavior of REFRESHLoadState, which generally defers to mediator if it exists, but if previously was LoadState.Loading, awaits for both source and mediator to become LoadState.NotLoading to ensure the remote load was applied.

For use cases that require reacting to LoadState of source and mediator specifically, e.g., showing cached data when network loads via mediator fail, LoadStat