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 constructors

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

Public methods

boolean
equals(Object other)
final @NonNull LoadState

Convenience for combined behavior of APPEND LoadState, 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 LoadStates

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

final @NonNull LoadState

Convenience for combined behavior of PREPEND LoadState, 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 REFRESH LoadState, 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.

final boolean

Returns true if either source or mediator has a LoadType that is in LoadState.Error

int
final boolean

Returns true when source and mediator is in NotLoading for all LoadType

@NonNull String

Public constructors

CombinedLoadStates

Added in 3.0.0
public CombinedLoadStates(
    @NonNull LoadState refresh,
    @NonNull LoadState prepend,
    @NonNull LoadState append,
    @NonNull LoadStates source,
    LoadStates mediator
)

Public methods

equals

public boolean equals(Object other)

getAppend

Added in 3.0.0
public final @NonNull LoadState getAppend()

Convenience for combined behavior of APPEND LoadState, 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.

getMediator

Added in 3.0.0
public final LoadStates getMediator()

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

getPrepend

Added in 3.0.0
public final @NonNull LoadState getPrepend()

Convenience for combined behavior of PREPEND LoadState, 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.

getRefresh

Added in 3.0.0
public final @NonNull LoadState getRefresh()

Convenience for combined behavior of REFRESH LoadState, 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.

getSource

Added in 3.0.0
public final @NonNull LoadStates getSource()

LoadStates corresponding to loads from a PagingSource.

hasError

Added in 3.3.4
public final boolean hasError()

Returns true if either source or mediator has a LoadType that is in LoadState.Error

hashCode

public int hashCode()

isIdle

Added in 3.3.4
public final boolean isIdle()

Returns true when source and mediator is in NotLoading for all LoadType

toString

public @NonNull String toString()