From fb951b60f8062b63eefb1cc93a26efa37dc2dbfb Mon Sep 17 00:00:00 2001 From: Nick Butcher Date: Thu, 11 Jul 2019 08:35:30 +0100 Subject: [PATCH] Always configure spring force. --- .../main/java/io/plaidapp/core/util/SpringUtils.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/io/plaidapp/core/util/SpringUtils.kt b/core/src/main/java/io/plaidapp/core/util/SpringUtils.kt index 94beef8d2..b54835cad 100644 --- a/core/src/main/java/io/plaidapp/core/util/SpringUtils.kt +++ b/core/src/main/java/io/plaidapp/core/util/SpringUtils.kt @@ -37,15 +37,14 @@ fun View.spring( val key = getKey(property) var springAnim = getTag(key) as? SpringAnimation? if (springAnim == null) { - springAnim = SpringAnimation(this, property).apply { - spring = SpringForce().apply { - this.dampingRatio = damping - this.stiffness = stiffness - startVelocity?.let { setStartVelocity(it) } - } - } + springAnim = SpringAnimation(this, property) setTag(key, springAnim) } + springAnim.spring = (springAnim.spring ?: SpringForce()).apply { + this.dampingRatio = damping + this.stiffness = stiffness + } + startVelocity?.let { springAnim.setStartVelocity(it) } return springAnim }