FloatPropertyCompat


abstract class FloatPropertyCompat<T>

Known direct subclasses
DynamicAnimation.ViewProperty

ViewProperty holds the access of a property of a View.


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 and getter getValue 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 createFloatPropertyCompat.

Parameters
<T>

the class on which the Property is declared

Summary

Public constructors

A constructor that takes an identifying name.

Public functions

java-static FloatPropertyCompat<T!>!
@RequiresApi(value = 24)
<T> createFloatPropertyCompat(property: FloatProperty<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

FloatPropertyCompat

Added in 1.0.0
FloatPropertyCompat(name: String!)

A constructor that takes an identifying name.

Public functions

createFloatPropertyCompat

Added in 1.0.0
@RequiresApi(value = 24)
java-static fun <T> 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
<T>

the class on which the Property is declared

property: FloatProperty<T!>!

FloatProperty instance to be wrapped

Returns
FloatPropertyCompat<T!>!

a new FloatPropertyCompat wrapper for the given FloatProperty object

getValue

Added in 1.0.0
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

Returns
Float

the current property value of the given object

setValue

Added in 1.0.0
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: Float

new value of the property