Made the ViewHeightAnimator duration configurable

This commit is contained in:
Jobobby04 2020-08-18 22:07:39 -04:00
parent f7bc3e0a82
commit eb0a1668f8

View File

@ -6,7 +6,7 @@ import android.view.ViewTreeObserver
import android.view.animation.DecelerateInterpolator
import androidx.annotation.Keep
class ViewHeightAnimator(val view: View) {
class ViewHeightAnimator(val view: View, val duration: Long = 250L) {
/**
* The default height of the view. It's unknown until the view is layout.
@ -23,7 +23,7 @@ class ViewHeightAnimator(val view: View) {
*/
private val animation by lazy {
ObjectAnimator.ofInt(this, "height", height).apply {
duration = 250L
duration = this@ViewHeightAnimator.duration
interpolator = DecelerateInterpolator()
}
}