DifferentialMotionFlingController


class DifferentialMotionFlingController


Controller differential motion flings.

Differential motion here refers to motions that report change in position instead of absolution position. For instance, differential data points of 2, -1, 5 represent: there was a movement by "2" units, then by "-1" units, then by "5" units. Examples of motions reported differentially include motions from AXIS_SCROLL.

The client should call onMotionEvent when a differential motion event happens on the target View (that is, the View on which we want to fling), and this class processes the event to orchestrate fling.

Note that this class currently works to control fling only in one direction at a time. As such, it works independently of horizontal/vertical orientations. It requests its client to start/stop fling, and it's up to the client to choose the fling direction based on its specific internal configurations and/or preferences.

Summary

Public constructors

Constructs an instance for a given DifferentialMotionFlingTarget.

Public functions

Unit
onMotionEvent(event: MotionEvent, axis: Int)

Called to report when a differential motion happens on the View that's the target for fling.

Public constructors

DifferentialMotionFlingController

Added in 1.13.0
DifferentialMotionFlingController(
    context: Context,
    target: DifferentialMotionFlingTarget
)

Constructs an instance for a given DifferentialMotionFlingTarget.

Public functions

onMotionEvent

Added in 1.13.0
fun onMotionEvent(event: MotionEvent, axis: Int): Unit

Called to report when a differential motion happens on the View that's the target for fling.

Parameters
event: MotionEvent

the MotionEvent being reported.

axis: Int

the axis being processed by the target View.