public Flowable<ViewModel> perform(
Flowable<PaginationParam> paginationSource) {
return Flowable.combineLatest(
mConnectionState.getConnectionState(),
mSessionInfo,
paginationSource,
Holder::combine)
.flatMap(this::toViewModel);
}
Now I want to start perform() when I am on the second page so my point is listen Pagination change and when it is not the first page(0) then call call perform().
final Flowable<PaginationParam > paginationSource =
mPagination.observe(this).filter(it -> it.getOffset() != 0);
I don't know how can I combine these.?
you can change you perform
function:
public Flowable<ViewModel> perform(PaginationParam paginationParam) {
return Flowable.combineLatest(
mConnectionState.getConnectionState(),
mSessionInfo,
{state, info -> Holder.combine(state, info, paginationParam)})
.flatMap(this::toViewModel);
}
and than use it:
paginationSource.flatMap( it -> perform(it))
.subscribe(...)
perform(paginationSource)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(viewModel -> {
// doAction
}, ex-> {
// Error
}, ()-> {
// Completed, will not emit new action
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.