diff --git a/changelog.d/6663.bugfix b/changelog.d/6663.bugfix new file mode 100644 index 0000000000..d90bb00d80 --- /dev/null +++ b/changelog.d/6663.bugfix @@ -0,0 +1 @@ +ObjectAnimators are not canceled in TypingMessageDotsView diff --git a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt index 2e9945c8d7..96af8450b9 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt @@ -42,6 +42,7 @@ class TypingMessageDotsView(context: Context, attrs: AttributeSet) : } private val circles = mutableListOf() + private val objectAnimators = mutableListOf() init { orientation = HORIZONTAL @@ -76,15 +77,17 @@ class TypingMessageDotsView(context: Context, attrs: AttributeSet) : } private fun animateCircle(index: Int, circle: View) { - ObjectAnimator.ofFloat(circle, "alpha", DEFAULT_MAX_ALPHA, DEFAULT_MIN_ALPHA).apply { + val objectAnimator = 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() + } + objectAnimators.add(objectAnimator) + objectAnimator.start() } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - circles.forEach { it.clearAnimation() } + objectAnimators.forEach { it.cancel() } } }