Made the ViewHeightAnimator duration configurable
This commit is contained in:
parent
f7bc3e0a82
commit
eb0a1668f8
@ -6,7 +6,7 @@ import android.view.ViewTreeObserver
|
|||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
import androidx.annotation.Keep
|
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.
|
* 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 {
|
private val animation by lazy {
|
||||||
ObjectAnimator.ofInt(this, "height", height).apply {
|
ObjectAnimator.ofInt(this, "height", height).apply {
|
||||||
duration = 250L
|
duration = this@ViewHeightAnimator.duration
|
||||||
interpolator = DecelerateInterpolator()
|
interpolator = DecelerateInterpolator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user