Skip to content

Instantly share code, notes, and snippets.

@shkcodes
Created April 26, 2020 12:06
Show Gist options
  • Save shkcodes/1f77f35fc032284337eeb3babec63939 to your computer and use it in GitHub Desktop.
Save shkcodes/1f77f35fc032284337eeb3babec63939 to your computer and use it in GitHub Desktop.
observable_view_property
private fun <T> viewProperty(default: T) = object : ObservableProperty<T>(default) {
override fun beforeChange(property: KProperty<*>, oldValue: T, newValue: T): Boolean =
newValue != oldValue
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) {
postInvalidateOnAnimation()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment