Use Animator.addListener() KTX extension
This commit is contained in:
parent
86f335b01f
commit
20bddd8e47
|
@ -1,11 +1,11 @@
|
||||||
package org.schabi.newpipe.views.player
|
package org.schabi.newpipe.views.player
|
||||||
|
|
||||||
import android.animation.Animator
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.animation.addListener
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.databinding.PlayerFastSeekSecondsViewBinding
|
import org.schabi.newpipe.databinding.PlayerFastSeekSecondsViewBinding
|
||||||
import org.schabi.newpipe.util.DeviceUtils
|
import org.schabi.newpipe.util.DeviceUtils
|
||||||
|
@ -163,19 +163,10 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
|
||||||
setFloatValues(0f, 1f)
|
setFloatValues(0f, 1f)
|
||||||
|
|
||||||
addUpdateListener { update(it.animatedValue as Float) }
|
addUpdateListener { update(it.animatedValue as Float) }
|
||||||
addListener(object : AnimatorListener {
|
addListener(
|
||||||
override fun onAnimationStart(animation: Animator?) {
|
onStart = { start() },
|
||||||
start()
|
onEnd = { end() }
|
||||||
}
|
)
|
||||||
|
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
|
||||||
end()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationCancel(animation: Animator?) = Unit
|
|
||||||
|
|
||||||
override fun onAnimationRepeat(animation: Animator?) = Unit
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue