Hide reader progress indicator right away (#5750)

The image will be drawn over it so the animation won't be visible anyway

(cherry picked from commit 4eaccc966eba26a47ed3e6d645dcccf8a4edf8ea)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt
This commit is contained in:
Ivan Iskandar 2021-08-20 05:12:31 +07:00 committed by Jobobby04
parent d621ef0b3a
commit 4603465783
3 changed files with 6 additions and 25 deletions

View File

@ -8,7 +8,6 @@ import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation import android.view.animation.RotateAnimation
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.annotation.IntRange import androidx.annotation.IntRange
import androidx.dynamicanimation.animation.DynamicAnimation
import com.google.android.material.progressindicator.CircularProgressIndicator import com.google.android.material.progressindicator.CircularProgressIndicator
/** /**
@ -84,27 +83,9 @@ class ReaderProgressIndicator @JvmOverloads constructor(
updateRotateAnimation() updateRotateAnimation()
} }
fun setCompleteProgressAndHide() { private fun updateRotateAnimation() {
val listener = object : DynamicAnimation.OnAnimationEndListener { if (isAttachedToWindow && indicator.isShown && !indicator.isIndeterminate) {
override fun onAnimationEnd( if (animation == null) {
animation: DynamicAnimation<*>?,
canceled: Boolean,
value: Float,
velocity: Float
) {
hide()
indicator.progressDrawable?.removeSpringAnimationEndListener(this)
}
}
indicator.progressDrawable?.addSpringAnimationEndListener(listener)
indicator.setProgressCompat(100, true)
updateRotateAnimation(forceRotate = true)
}
private fun updateRotateAnimation(forceRotate: Boolean = false) {
if (forceRotate || (indicator.isShown && !indicator.isIndeterminate)) {
if (animation == null && isAttachedToWindow) {
startAnimation(rotateAnimation) startAnimation(rotateAnimation)
} }
} else { } else {

View File

@ -339,7 +339,7 @@ class PagerPageHolder(
*/ */
private fun setImage() { private fun setImage() {
if (extraPage == null) { if (extraPage == null) {
progressIndicator.setCompleteProgressAndHide() progressIndicator.hide()
} else { } else {
progressIndicator.setProgress(95) progressIndicator.setProgress(95)
} }
@ -480,7 +480,7 @@ class PagerPageHolder(
return ImageUtil.mergeBitmaps(imageBitmap, imageBitmap2, isLTR, viewer.config.pageCanvasColor) { return ImageUtil.mergeBitmaps(imageBitmap, imageBitmap2, isLTR, viewer.config.pageCanvasColor) {
scope?.launchUI { scope?.launchUI {
if (it == 100) { if (it == 100) {
progressIndicator.setCompleteProgressAndHide() progressIndicator.hide()
} else { } else {
progressIndicator.setProgress(it) progressIndicator.setProgress(it)
} }

View File

@ -265,7 +265,7 @@ class WebtoonPageHolder(
* Called when the page is ready. * Called when the page is ready.
*/ */
private fun setImage() { private fun setImage() {
progressIndicator.setCompleteProgressAndHide() progressIndicator.hide()
retryContainer?.isVisible = false retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()