Skip to content

Commit

Permalink
#4642 [Review]
Browse files Browse the repository at this point in the history
 - use ObjectAnimator instead of ValueAnimator in TypingMessageDots.

Signed-off-by: Ahmed Radhouane Belkilani <[email protected]>
  • Loading branch information
ahmed-radhouane committed Feb 11, 2022
1 parent 91dc92a commit 7f51b05
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package im.vector.app.core.ui.views

import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.util.AttributeSet
Expand Down Expand Up @@ -75,14 +76,11 @@ class TypingMessageDotsView(context: Context, attrs: AttributeSet) :
}

private fun animateCircle(index: Int, circle: View) {
val animator = ValueAnimator.ofFloat(DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA)
animator.duration = DEFAULT_CIRCLE_DURATION
animator.startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
animator.repeatCount = ValueAnimator.INFINITE
animator.addUpdateListener {
circle.alpha = it.animatedValue as Float
}
animator.start()
ObjectAnimator.ofFloat(circle, "alpha", DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA).apply {
duration = DEFAULT_CIRCLE_DURATION
startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
repeatCount = ValueAnimator.INFINITE
}.start()
}

override fun onDetachedFromWindow() {
Expand Down

0 comments on commit 7f51b05

Please sign in to comment.