Fix wrong downloaded percentage when server doesn't send content length. Fixes #1019

This commit is contained in:
inorichi
2017-10-05 08:41:28 +02:00
parent 5aae17754f
commit f648940388
3 changed files with 15 additions and 3 deletions

View File

@@ -130,7 +130,11 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
.onBackpressureLatest()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { progress ->
progress_text.text = context.getString(R.string.download_progress, progress)
progress_text.text = if (progress > 0) {
context.getString(R.string.download_progress, progress)
} else {
context.getString(R.string.downloading)
}
}
}

View File

@@ -150,7 +150,11 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
.onBackpressureLatest()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { progress ->
view.progress_text.text = view.context.getString(R.string.download_progress, progress)
view.progress_text.text = if (progress > 0) {
view.context.getString(R.string.download_progress, progress)
} else {
view.context.getString(R.string.downloading)
}
}
addSubscription(progressSubscription)