Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/* Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
fun View.spring(
property: ViewProperty
): SpringAnimation {
val key = getKey(property)
var springAnim = getTag(key) as? SpringAnimation?
if (springAnim == null) {
springAnim = SpringAnimation(this, property)
setTag(key, springAnim)
}
return springAnim
}
@dfeverx

This comment has been minimized.

Copy link

commented Sep 21, 2019

Is this ViewProperty from DynamicAnimation.ViewProperty?

@nickbutcher

This comment has been minimized.

Copy link
Owner Author

commented Sep 21, 2019

@dfeverx yes.

@dfeverx

This comment has been minimized.

Copy link

commented Sep 21, 2019

when I try this code in ide ,i get an error at "get Key(property)"

@dfeverx

This comment has been minimized.

Copy link

commented Sep 21, 2019

Unresolved reference: getKey

@nickbutcher

This comment has been minimized.

Copy link
Owner Author

commented Sep 21, 2019

Yeah these are minimal snippets for a blog post. See this PR for a more complete implementation: android/plaid#751

@dfeverx

This comment has been minimized.

Copy link

commented Sep 21, 2019

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.