MotionLayout.TransitionListener

public static interface MotionLayout.TransitionListener

androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener


Added in 2.0

Listener for monitoring events about TransitionLayout.

Summary

Public methods

abstract void onTransitionChange(MotionLayout motionLayout, int startId, int endId, float progress)

Called when a drawer's position changes.

abstract void onTransitionCompleted(MotionLayout motionLayout, int currentId)

Called when a drawer has settled completely a state.

abstract void onTransitionStarted(MotionLayout motionLayout, int startId, int endId)

Called when a drawer is about to start a transition.

abstract void onTransitionTrigger(MotionLayout motionLayout, int triggerId, boolean positive, float progress)

Call when a trigger is fired

Public methods

onTransitionChange

public abstract void onTransitionChange (MotionLayout motionLayout, 
                int startId, 
                int endId, 
                float progress)

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

public abstract void onTransitionCompleted (MotionLayout motionLayout, 
                int currentId)

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

public abstract void onTransitionStarted (MotionLayout motionLayout, 
                int startId, 
                int endId)

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

public abstract void onTransitionTrigger (MotionLayout motionLayout, 
                int triggerId, 
                boolean positive, 
                float progress)

Call when a trigger is fired

Parameters
triggerId int: The id set set with triggerID

positive boolean: for positive transition edge