Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HIFILEO/5aaf9275878a33141d109eebf07063d5 to your computer and use it in GitHub Desktop.
Save HIFILEO/5aaf9275878a33141d109eebf07063d5 to your computer and use it in GitHub Desktop.
compositeDisposable.add(RxRecyclerView.scrollEvents(nowPlayingBinding.recyclerView)
.flatMap(recyclerViewScrollEvent -> {
if (scrollEventCalculator.isAtScrollEnd()) {
return Observable.just(new ScrollEvent(pageNumber + 1));
} else {
return Observable.empty();
}
})
.debounce(scrollEvent -> Observable.<ScrollEvent>empty().delay(250, TimeUnit.MILLISECONDS))
.subscribe(scrollEvent -> nowPlayingViewModel.processUiEvent(scrollEvent), throwable -> {
throw new UnsupportedOperationException("Errors in scroll event unsupported. Crash app.");
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment