From 20bddd8e47383408bc04e0ff2a35d5b6971f4844 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Thu, 17 Mar 2022 22:01:51 -0400 Subject: [PATCH] Use Animator.addListener() KTX extension --- .../newpipe/views/player/SecondsView.kt | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt b/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt index d209d24da..8472653fb 100644 --- a/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt +++ b/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt @@ -1,11 +1,11 @@ package org.schabi.newpipe.views.player -import android.animation.Animator import android.animation.ValueAnimator import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater import android.widget.LinearLayout +import androidx.core.animation.addListener import org.schabi.newpipe.R import org.schabi.newpipe.databinding.PlayerFastSeekSecondsViewBinding import org.schabi.newpipe.util.DeviceUtils @@ -163,19 +163,10 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context setFloatValues(0f, 1f) addUpdateListener { update(it.animatedValue as Float) } - addListener(object : AnimatorListener { - override fun onAnimationStart(animation: Animator?) { - start() - } - - override fun onAnimationEnd(animation: Animator?) { - end() - } - - override fun onAnimationCancel(animation: Animator?) = Unit - - override fun onAnimationRepeat(animation: Animator?) = Unit - }) + addListener( + onStart = { start() }, + onEnd = { end() } + ) } } }