pull/32/head
kunfei 5 years ago
parent 86ffc61433
commit 1a3296badb
  1. 20
      app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt

@ -123,10 +123,10 @@ class RotateLoading : View {
topDegree += speedOfDegree topDegree += speedOfDegree
bottomDegree += speedOfDegree bottomDegree += speedOfDegree
if (topDegree > 360) { if (topDegree > 360) {
topDegree = topDegree - 360 topDegree -= 360
} }
if (bottomDegree > 360) { if (bottomDegree > 360) {
bottomDegree = bottomDegree - 360 bottomDegree -= 360
} }
if (changeBigger) { if (changeBigger) {
@ -176,10 +176,10 @@ class RotateLoading : View {
private fun startAnimator() { private fun startAnimator() {
val scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.0f, 1f) val scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.0f, 1f)
val scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 0.0f, 1f) val scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 0.0f, 1f)
scaleXAnimator.setDuration(300) scaleXAnimator.duration = 300
scaleXAnimator.setInterpolator(LinearInterpolator()) scaleXAnimator.interpolator = LinearInterpolator()
scaleYAnimator.setDuration(300) scaleYAnimator.duration = 300
scaleYAnimator.setInterpolator(LinearInterpolator()) scaleYAnimator.interpolator = LinearInterpolator()
val animatorSet = AnimatorSet() val animatorSet = AnimatorSet()
animatorSet.playTogether(scaleXAnimator, scaleYAnimator) animatorSet.playTogether(scaleXAnimator, scaleYAnimator)
animatorSet.start() animatorSet.start()
@ -188,10 +188,10 @@ class RotateLoading : View {
private fun stopAnimator() { private fun stopAnimator() {
val scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0f) val scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0f)
val scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 1f, 0f) val scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 1f, 0f)
scaleXAnimator.setDuration(300) scaleXAnimator.duration = 300
scaleXAnimator.setInterpolator(LinearInterpolator()) scaleXAnimator.interpolator = LinearInterpolator()
scaleYAnimator.setDuration(300) scaleYAnimator.duration = 300
scaleYAnimator.setInterpolator(LinearInterpolator()) scaleYAnimator.interpolator = LinearInterpolator()
val animatorSet = AnimatorSet() val animatorSet = AnimatorSet()
animatorSet.playTogether(scaleXAnimator, scaleYAnimator) animatorSet.playTogether(scaleXAnimator, scaleYAnimator)
animatorSet.addListener(object : Animator.AnimatorListener { animatorSet.addListener(object : Animator.AnimatorListener {

Loading…
Cancel
Save