Trying to fix a backpressure issue (#17).

This commit is contained in:
inorichi 2016-01-05 18:47:25 +01:00
parent 2f66b6e56c
commit dd833852ad
2 changed files with 4 additions and 4 deletions

View File

@ -147,14 +147,15 @@ public class ReaderPresenter extends BasePresenter<ReaderActivity> {
if (!isDownloaded) {
pageObservable = source.getAllImageUrlsFromPageList(pageList)
.flatMap(source::getCachedImage, 3);
.flatMap(source::getCachedImage, 2);
} else {
File chapterDir = downloadManager.getAbsoluteChapterDirectory(source, manga, chapter);
pageObservable = Observable.from(pageList)
.flatMap(page -> downloadManager.getDownloadedImage(page, chapterDir));
}
return pageObservable
return Observable.defer(() -> pageObservable)
.subscribeOn(Schedulers.io())
.onBackpressureBuffer()
.observeOn(AndroidSchedulers.mainThread());
}

View File

@ -7,8 +7,6 @@
<item name="alertDialogTheme">@style/AlertDialogStyle</item>
<item name="android:itemTextAppearance">@style/OptionsMenuTextColor</item>
<item name="android:textColor">@color/primary_text</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="colorControlNormal">@color/white</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
@ -19,6 +17,7 @@
<item name="android:spinnerItemStyle">@style/ActionBarSpinner</item>
<item name="android:actionModeBackground">@color/colorPrimarySuperDark</item>
<item name="actionModeBackground">@color/colorPrimarySuperDark</item>
<item name="colorControlNormal">@color/white</item>
</style>
<style name="AppTheme.Overlay.Dark" parent="ThemeOverlay.AppCompat.Dark.ActionBar">