Skip to content

Commit

Permalink
use onbackpressurebuffer in anime contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
jmir1 committed Jun 8, 2021
1 parent 096ea08 commit eff1bb5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AnimeUpdatesPresenter(

downloadManager.queue.getStatusObservable()
.observeOn(Schedulers.io())
.onBackpressureLatest()
.onBackpressureBuffer()
.observeOn(AndroidSchedulers.mainThread())
.subscribeLatestCache(
{ view, it ->
Expand All @@ -55,7 +55,7 @@ class AnimeUpdatesPresenter(

downloadManager.queue.getProgressObservable()
.observeOn(Schedulers.io())
.onBackpressureLatest()
.onBackpressureBuffer()
.observeOn(AndroidSchedulers.mainThread())
.subscribeLatestCache(AnimeUpdatesController::onEpisodeDownloadUpdate) { _, error ->
Timber.e(error)
Expand Down

0 comments on commit eff1bb5

Please sign in to comment.