Skip to content

Commit 7f51b05

Browse files
#4642 [Review]
- use ObjectAnimator instead of ValueAnimator in TypingMessageDots. Signed-off-by: Ahmed Radhouane Belkilani <[email protected]>
1 parent 91dc92a commit 7f51b05

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt

+6-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

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

19+
import android.animation.ObjectAnimator
1920
import android.animation.ValueAnimator
2021
import android.content.Context
2122
import android.util.AttributeSet
@@ -75,14 +76,11 @@ class TypingMessageDotsView(context: Context, attrs: AttributeSet) :
7576
}
7677

7778
private fun animateCircle(index: Int, circle: View) {
78-
val animator = ValueAnimator.ofFloat(DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA)
79-
animator.duration = DEFAULT_CIRCLE_DURATION
80-
animator.startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
81-
animator.repeatCount = ValueAnimator.INFINITE
82-
animator.addUpdateListener {
83-
circle.alpha = it.animatedValue as Float
84-
}
85-
animator.start()
79+
ObjectAnimator.ofFloat(circle, "alpha", DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA).apply {
80+
duration = DEFAULT_CIRCLE_DURATION
81+
startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
82+
repeatCount = ValueAnimator.INFINITE
83+
}.start()
8684
}
8785

8886
override fun onDetachedFromWindow() {

0 commit comments

Comments
 (0)