#4642 [Review]
- use ObjectAnimator instead of ValueAnimator in TypingMessageDots. Signed-off-by: Ahmed Radhouane Belkilani <arbelkilani@gmail.com>
This commit is contained in:
parent
5deabfae9d
commit
b39a3ab42e
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package im.vector.app.core.ui.views
|
package im.vector.app.core.ui.views
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
@ -75,14 +76,11 @@ class TypingMessageDotsView(context: Context, attrs: AttributeSet) :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun animateCircle(index: Int, circle: View) {
|
private fun animateCircle(index: Int, circle: View) {
|
||||||
val animator = ValueAnimator.ofFloat(DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA)
|
ObjectAnimator.ofFloat(circle, "alpha", DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA).apply {
|
||||||
animator.duration = DEFAULT_CIRCLE_DURATION
|
duration = DEFAULT_CIRCLE_DURATION
|
||||||
animator.startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
|
startDelay = DEFAULT_START_ANIM_CIRCLE_DURATION * index
|
||||||
animator.repeatCount = ValueAnimator.INFINITE
|
repeatCount = ValueAnimator.INFINITE
|
||||||
animator.addUpdateListener {
|
}.start()
|
||||||
circle.alpha = it.animatedValue as Float
|
|
||||||
}
|
|
||||||
animator.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
override fun onDetachedFromWindow() {
|
||||||
|
|
Loading…
Reference in New Issue