Only preload pages without the image url

This commit is contained in:
inorichi 2015-11-28 20:11:56 +01:00
parent 34201bece1
commit c803b91223

View File

@ -183,7 +183,9 @@ public class ReaderPresenter extends BasePresenter<ReaderActivity> {
int pagesToPreload = Math.min(pages.size(), 5); int pagesToPreload = Math.min(pages.size(), 5);
return Observable.from(pages) return Observable.from(pages)
.take(pagesToPreload) .take(pagesToPreload)
.concatMap(source::getImageUrlFromPage) .concatMap(page -> page.getImageUrl() == null ?
source.getImageUrlFromPage(page) :
Observable.just(page))
.doOnCompleted(this::stopPreloadingNextChapter); .doOnCompleted(this::stopPreloadingNextChapter);
}) })
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())