Google 致力于为黑人社区推动种族平等。查看具体举措

androidx.paging.rxjava3

Classes

RxPagingSource

Rx-based compatibility wrapper around PagingSource's suspending APIs.

RxRemoteMediator

RxJava3 compatibility wrapper around RemoteMediator's suspending APIs.

Extension functions summary

For io.reactivex.rxjava3.core.Flowable
Flowable<PagingData<T>>
Flowable<PagingData<T>>.cachedIn(scope: CoroutineScope)

Operator which caches a Flowable of PagingData within a CoroutineScope.

For io.reactivex.rxjava3.core.Observable
Observable<PagingData<T>>
Observable<PagingData<T>>.cachedIn(scope: CoroutineScope)

Operator which caches an Observable of PagingData within a CoroutineScope.

For PagingData
PagingData<T>
PagingData<T>.filterAsync(predicate: (T) -> Single<Boolean>)

Returns a PagingData containing only elements matching the given predicate.

PagingData<R>
PagingData<T>.flatMapAsync(transform: (T) -> Single<Iterable<R>>)

Returns a PagingData of all elements returned from applying the given transform to each element, as it is loaded.

PagingData<R>
PagingData<T>.insertSeparatorsAsync(generator: (T?, T?) -> Maybe<R>)

Returns a PagingData containing each original element, with an optional separator generated by generator, given the elements before and after (or null, in boundary conditions).

PagingData<R>
PagingData<T>.mapAsync(transform: (T) -> Single<R>)

Returns a PagingData containing the result of applying the given transform to each element, as it is loaded.

Extension properties summary

For Pager
Flowable<PagingData<Value>>
Pager<Key, Value>.flowable()

A Flowable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as a Flowable.

Observable<PagingData<Value>>
Pager<Key, Value>.observable()

An Observable of PagingData, which mirrors the stream provided by Pager.flow, but exposes it as an Observable.

Extension functions

cachedIn

@ExperimentalCoroutinesApi fun <T : Any> Flowable<PagingData<T>>.cachedIn(scope: CoroutineScope): Flowable<PagingData<T>>

Operator which caches a Flowable of PagingData within a CoroutineScope.

cachedIn multicasts pages loaded and transformed by a PagingData, allowing multiple observers on the same instance of PagingData to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.

Calling cachedIn is required to allow calling submitData on the same instance of PagingData emitted by Pager or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData is an unsupported operation.

Parameters
scope: CoroutineScope The CoroutineScope where the page cache will be kept alive. Typically this would be a managed scope such as ViewModel.viewModelScope, which automatically cancels after the PagingData stream is no longer needed. Otherwise, the provided CoroutineScope must be manually cancelled to avoid memory leaks.

cachedIn

@ExperimentalCoroutinesApi fun <T : Any> Observable<PagingData<T>>.