Răsfoiți Sursa

Fix download status not updated properly after starting batch download (#5348)

Ivan Iskandar 3 ani în urmă
părinte
comite
31d96c2bf0

+ 2 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt

@@ -359,7 +359,7 @@ class MangaPresenter(
         observeDownloadsStatusSubscription?.let { remove(it) }
         observeDownloadsStatusSubscription = downloadManager.queue.getStatusObservable()
             .observeOn(Schedulers.io())
-            .onBackpressureLatest()
+            .onBackpressureBuffer()
             .filter { download -> download.manga.id == manga.id }
             .observeOn(AndroidSchedulers.mainThread())
             .subscribeLatestCache(
@@ -375,7 +375,7 @@ class MangaPresenter(
         observeDownloadsPageSubscription?.let { remove(it) }
         observeDownloadsPageSubscription = downloadManager.queue.getProgressObservable()
             .observeOn(Schedulers.io())
-            .onBackpressureLatest()
+            .onBackpressureBuffer()
             .filter { download -> download.manga.id == manga.id }
             .observeOn(AndroidSchedulers.mainThread())
             .subscribeLatestCache(MangaController::onChapterDownloadUpdate) { _, error ->

+ 1 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterDownloadView.kt

@@ -48,8 +48,6 @@ class ChapterDownloadView @JvmOverloads constructor(context: Context, attrs: Att
                 state == Download.State.NOT_DOWNLOADED || state == Download.State.QUEUE
             if (shouldBeVisible) {
                 hideAnimationBehavior = BaseProgressIndicator.HIDE_NONE
-                show()
-
                 if (state == Download.State.NOT_DOWNLOADED || state == Download.State.QUEUE) {
                     trackThickness = 2.dpToPx
                     setIndicatorColor(context.getThemeColor(android.R.attr.textColorHint))
@@ -72,6 +70,7 @@ class ChapterDownloadView @JvmOverloads constructor(context: Context, attrs: Att
                     setIndicatorColor(context.getThemeColor(android.R.attr.textColorPrimary))
                     setProgressCompat(progress, true)
                 }
+                show()
             } else {
                 hideAnimationBehavior = BaseProgressIndicator.HIDE_OUTWARD
                 hide()

+ 2 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt

@@ -41,7 +41,7 @@ class UpdatesPresenter(
 
         downloadManager.queue.getStatusObservable()
             .observeOn(Schedulers.io())
-            .onBackpressureLatest()
+            .onBackpressureBuffer()
             .observeOn(AndroidSchedulers.mainThread())
             .subscribeLatestCache(
                 { view, it ->
@@ -55,7 +55,7 @@ class UpdatesPresenter(
 
         downloadManager.queue.getProgressObservable()
             .observeOn(Schedulers.io())
-            .onBackpressureLatest()
+            .onBackpressureBuffer()
             .observeOn(AndroidSchedulers.mainThread())
             .subscribeLatestCache(UpdatesController::onChapterDownloadUpdate) { _, error ->
                 Timber.e(error)