From eff1bb56eed146a27149fb35b2818f44bd591069 Mon Sep 17 00:00:00 2001 From: jmir1 Date: Tue, 8 Jun 2021 21:23:46 +0200 Subject: [PATCH] use onbackpressurebuffer in anime contexts --- app/build.gradle.kts | 2 +- .../main/java/eu/kanade/tachiyomi/ui/anime/AnimePresenter.kt | 4 ++-- .../kanade/tachiyomi/ui/anime/episode/EpisodeDownloadView.kt | 3 +-- .../tachiyomi/ui/recent/animeupdates/AnimeUpdatesPresenter.kt | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6fed5fd945..1917634659 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -31,7 +31,7 @@ android { targetSdkVersion(AndroidConfig.targetSdk) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" versionCode = 63 - versionName = "0.11.1.3-mi" + versionName = "0.11.1.4-mi" buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimePresenter.kt index 2baacac070..78b5ef0a23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimePresenter.kt @@ -366,7 +366,7 @@ class AnimePresenter( observeDownloadsStatusSubscription?.let { remove(it) } observeDownloadsStatusSubscription = downloadManager.queue.getStatusObservable() .observeOn(Schedulers.io()) - .onBackpressureLatest() + .onBackpressureBuffer() .filter { download -> download.anime.id == anime.id } .observeOn(AndroidSchedulers.mainThread()) .subscribeLatestCache( @@ -382,7 +382,7 @@ class AnimePresenter( observeDownloadsPageSubscription?.let { remove(it) } observeDownloadsPageSubscription = downloadManager.queue.getProgressObservable() .observeOn(Schedulers.io()) - .onBackpressureLatest() + .onBackpressureBuffer() .filter { download -> download.anime.id == anime.id } .observeOn(AndroidSchedulers.mainThread()) .subscribeLatestAnimeCache(AnimeController::onEpisodeDownloadUpdate) { _, error -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/episode/EpisodeDownloadView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/episode/EpisodeDownloadView.kt index 9fc445f0a8..9143571ff6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/episode/EpisodeDownloadView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/episode/EpisodeDownloadView.kt @@ -48,8 +48,6 @@ class EpisodeDownloadView @JvmOverloads constructor(context: Context, attrs: Att state == AnimeDownload.State.NOT_DOWNLOADED || state == AnimeDownload.State.QUEUE if (shouldBeVisible) { hideAnimationBehavior = BaseProgressIndicator.HIDE_NONE - show() - if (state == AnimeDownload.State.NOT_DOWNLOADED || state == AnimeDownload.State.QUEUE) { trackThickness = 2.dpToPx setIndicatorColor(context.getThemeColor(android.R.attr.textColorHint)) @@ -72,6 +70,7 @@ class EpisodeDownloadView @JvmOverloads constructor(context: Context, attrs: Att setIndicatorColor(context.getThemeColor(android.R.attr.textColorPrimary)) setProgressCompat(progress, true) } + show() } else { hideAnimationBehavior = BaseProgressIndicator.HIDE_OUTWARD hide() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/animeupdates/AnimeUpdatesPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/animeupdates/AnimeUpdatesPresenter.kt index 356159421b..dc574a08c7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/animeupdates/AnimeUpdatesPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/animeupdates/AnimeUpdatesPresenter.kt @@ -41,7 +41,7 @@ class AnimeUpdatesPresenter( downloadManager.queue.getStatusObservable() .observeOn(Schedulers.io()) - .onBackpressureLatest() + .onBackpressureBuffer() .observeOn(AndroidSchedulers.mainThread()) .subscribeLatestCache( { view, it -> @@ -55,7 +55,7 @@ class AnimeUpdatesPresenter( downloadManager.queue.getProgressObservable() .observeOn(Schedulers.io()) - .onBackpressureLatest() + .onBackpressureBuffer() .observeOn(AndroidSchedulers.mainThread()) .subscribeLatestCache(AnimeUpdatesController::onEpisodeDownloadUpdate) { _, error -> Timber.e(error)