Răsfoiți Sursa

Trying to fix a backpressure issue (#17).

inorichi 9 ani în urmă
părinte
comite
dd833852ad

+ 3 - 2
app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderPresenter.java

@@ -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());
     }
 

+ 1 - 2
app/src/main/res/values/styles.xml

@@ -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">