FloatValueHolder

class FloatValueHolder


FloatValueHolder holds a float value. FloatValueHolder provides a setter and a getter ( i.e. setValue and getValue) to access this float value. Animations can be performed on a FloatValueHolder instance. During each frame of the animation, the FloatValueHolder will have its value updated via setValue. The caller can obtain the up-to-date animation value via getValue.

Here is an example for creating a FlingAnimation with a FloatValueHolder:

// Create a fling animation with an initial velocity of 5000 (pixel/s) and an initial position
// of 20f.
FloatValueHolder floatValueHolder = new FloatValueHolder(20f);
FlingAnimation anim = new FlingAnimation(floatValueHolder).setStartVelocity(5000);
anim.start();

Summary

Public constructors

Constructs a holder for a float value that is initialized to 0.

Constructs a holder for a float value that is initialized to the input value.

Public functions

Float

Returns the float value held in the FloatValueHolder instance.

Unit
setValue(value: Float)

Sets the value held in the FloatValueHolder instance.

Public constructors

FloatValueHolder

Added in 1.0.0
FloatValueHolder()

Constructs a holder for a float value that is initialized to 0.

FloatValueHolder

Added in 1.0.0
FloatValueHolder(value: Float)

Constructs a holder for a float value that is initialized to the input value.

Parameters
value: Float

the value to initialize the value held in the FloatValueHolder

Public functions

getValue

Added in 1.0.0
fun getValue(): Float

Returns the float value held in the FloatValueHolder instance.

Returns
Float

float value held in the FloatValueHolder instance

setValue

Added in 1.0.0
fun setValue(value: Float): Unit

Sets the value held in the FloatValueHolder instance.

Parameters
value: Float

float value held in the FloatValueHolder instance