Skip to content

Commit 01e9e1d

Browse files
committed
bugfix: animator leaks, removeAllUpdateListeners and removeAllListeners.
1 parent 68552dc commit 01e9e1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ open class SVGAImageView : ImageView {
176176
}
177177

178178
fun startAnimation(range: SVGARange?, reverse: Boolean = false) {
179-
animator?.cancel()
179+
stopAnimation(false)
180180
val drawable = drawable as? SVGADrawable ?: return
181181
drawable.cleared = false
182182
drawable.scaleType = scaleType
@@ -247,6 +247,7 @@ open class SVGAImageView : ImageView {
247247

248248
fun stopAnimation(clear: Boolean) {
249249
animator?.cancel()
250+
animator?.removeAllListeners()
250251
animator?.removeAllUpdateListeners()
251252
(drawable as? SVGADrawable)?.let {
252253
it.cleared = clear

0 commit comments

Comments
 (0)