Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

FloatPropertyCompat

abstract class FloatPropertyCompat<T : Any!>
kotlin.Any
   ↳ androidx.dynamicanimation.animation.FloatPropertyCompat

FloatPropertyCompat is an abstraction that can be used to represent a mutable float value that is held in a host object. To access this float value, setValue(Object, float) and getter getValue(Object) need to be implemented. Both the setter and the getter take the primitive float type and avoids autoboxing and other overhead associated with the Float class.

For API 24 and later, FloatProperty instances can be converted to FloatPropertyCompat through FloatPropertyCompat#createFloatPropertyCompat(FloatProperty).

Summary

Public constructors
<init>(name: String!)

A constructor that takes an identifying name.

Public methods
open static FloatPropertyCompat<T>!

Create a FloatPropertyCompat wrapper for a FloatProperty object.

abstract Float
getValue(object: T)

Returns the current value that this property represents on the given object.

abstract Unit
setValue(object: T, value: Float)

Sets the value on object which this property represents.

Public constructors

<init>

FloatPropertyCompat(name: String!)

A constructor that takes an identifying name.

Public methods

createFloatPropertyCompat

open static fun <T : Any!> createFloatPropertyCompat(property: FloatProperty<T>!): FloatPropertyCompat<T>!

Create a FloatPropertyCompat wrapper for a FloatProperty object. The new FloatPropertyCompat instance will access and modify the property value of FloatProperty through the FloatProperty instance's setter and getter.

Parameters
property FloatProperty<T>!: FloatProperty instance to be wrapped
<T> FloatProperty<T>!: the class on which the Property is declared
Return
FloatPropertyCompat<T>!: a new FloatPropertyCompat wrapper for the given FloatProperty object

getValue

abstract fun getValue(object: T): Float

Returns the current value that this property represents on the given object.

Parameters
object T: object which this property represents
Return
Float: the current property value of the given object

setValue

abstract fun setValue(object: T, value: Float): Unit

Sets the value on object which this property represents.

Parameters
object T: object which this property represents
value T: new value of the property