MotionLayout.TransitionListener


interface MotionLayout.TransitionListener

Known direct subclasses
MotionHelperInterface

This defined the interface for MotionLayout helpers Helpers can be used to draw motion effects or modify motions

TransitionAdapter
Known indirect subclasses
Carousel

Carousel works within a MotionLayout to provide a simple recycler like pattern.

MotionEffect

MotionHelper that automatically inserts keyframes for views moving in a given direction, out of:

MotionHelper

Listener for monitoring events about TransitionLayout. Added in 2.0

Summary

Public functions

Unit
onTransitionChange(
    motionLayout: MotionLayout!,
    startId: Int,
    endId: Int,
    progress: Float
)

Called when a drawer's position changes.

Unit
onTransitionCompleted(motionLayout: MotionLayout!, currentId: Int)

Called when a drawer has settled completely a state.

Unit
onTransitionStarted(motionLayout: MotionLayout!, startId: Int, endId: Int)

Called when a drawer is about to start a transition.

Unit
onTransitionTrigger(
    motionLayout: MotionLayout!,
    triggerId: Int,
    positive: Boolean,
    progress: Float
)

Call when a trigger is fired

Public functions

onTransitionChange

Added in 2.2.0-alpha13
fun onTransitionChange(
    motionLayout: MotionLayout!,
    startId: Int,
    endId: Int,
    progress: Float
): Unit

Called when a drawer's position changes.

Parameters
motionLayout: MotionLayout!

The TransitionLayout view that was moved

startId: Int

the id of the start state (or ConstraintSet). Will be -1 if unknown.

endId: Int

the id of the end state (or ConstraintSet).

progress: Float

The progress on this transition, from 0 to 1.

onTransitionCompleted

Added in 2.2.0-alpha13
fun onTransitionCompleted(motionLayout: MotionLayout!, currentId: Int): Unit

Called when a drawer has settled completely a state. The TransitionLayout is interactive at this point.

Parameters
motionLayout: MotionLayout!

Drawer view that is now open

currentId: Int

the id it has reached

onTransitionStarted

Added in 2.2.0-alpha13
fun onTransitionStarted(motionLayout: MotionLayout!, startId: Int, endId: Int): Unit

Called when a drawer is about to start a transition. Note. startId may be -1 if starting from an "undefined state"

Parameters
motionLayout: MotionLayout!

The TransitionLayout view that was moved

startId: Int

the id of the start state (or ConstraintSet). Will be -1 if unknown.

endId: Int

the id of the end state (or ConstraintSet).

onTransitionTrigger

Added in 2.2.0-alpha13
fun onTransitionTrigger(
    motionLayout: MotionLayout!,
    triggerId: Int,
    positive: Boolean,
    progress: Float
): Unit

Call when a trigger is fired

Parameters
motionLayout: MotionLayout!
triggerId: Int

The id set set with triggerID

positive: Boolean

for positive transition edge

progress: Float