DragValueController

interface DragValueController
androidx.ui.foundation.gestures.DragValueController

Interface that defines behaviour of value that is dragged via Draggable

Summary

Public methods

abstract Unit
onDrag(target: Float)

Perform drag to target on controlled value

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

Perform finishing activities when drag has ended with given velocity

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

Set bounds for controlled value

Properties

abstract Float

Current Float value of controlled value

Public methods

onDrag

abstract fun onDrag(target: Float): Unit

Perform drag to target on controlled value

Parameters
target: Float the resulted position for controlled value

onDragEnd

abstract 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

abstract 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

abstract val currentValue: Float

Current Float value of controlled value