FloatDragValueController

class FloatDragValueController : DragValueController
kotlin.Any
   ↳ androidx.ui.foundation.gestures.FloatDragValueController

Simple DragValueController that backs up single Float value with no fling support

Summary

Public constructors

<init>(initialValue: Float)

Simple DragValueController that backs up single Float value with no fling support

Public methods

Unit
onDrag(target: Float)

Perform drag to target on controlled value

Unit
onDragEnd(velocity: Float, onValueSettled: (Float) -> Unit)

Perform finishing activities when drag has ended with given velocity

Unit
setBounds(min: Float, max: Float)

Set bounds for controlled value

Properties

Float

Current Float value of controlled value

Public constructors

<init>

FloatDragValueController(initialValue: Float)

Simple DragValueController that backs up single Float value with no fling support

Parameters
initialValue: Float the initial value to set for controlled Float value

Public methods

onDrag

fun onDrag(target: Float): Unit

Perform drag to target on controlled value

Parameters
target: Float the resulted position for controlled value

onDragEnd

fun onDragEnd(
    velocity: Float,
    onValueSettled: (Float) -> Unit
): Unit

Perform finishing activities when drag has ended with given velocity

This is a good place to start fling or consume velocity in some other way if you need to do so.

Callback passed to this function must be called after controlled value reached it's final destination, e.g. it might be an immediate drag end or the end of the fling.

Parameters
velocity: Float the velocity value when drag has ended
onValueSettled: (Float) -> Unit callback to call after fling has ended and controlled value settled

setBounds

fun setBounds(
    min: Float,
    max: Float
): Unit

Set bounds for controlled value

Parameters
min: Float lower bound for dragging
max: Float upper bound for dragging

Properties

currentValue

val currentValue: Float

Current Float value of controlled value