TransitionAdapter

public abstract class TransitionAdapter implements MotionLayout.TransitionListener


Summary

Public methods

@Override @NonNull void
onTransitionChange(
    @NonNull MotionLayout motionLayout,
    @NonNull int startId,
    @NonNull int endId,
    @NonNull float progress
)

Called when a drawer's position changes.

@Override @NonNull void
onTransitionCompleted(
    @NonNull MotionLayout motionLayout,
    @NonNull int currentId
)

Called when a drawer has settled completely a state.

@Override @NonNull void
onTransitionStarted(
    @NonNull MotionLayout motionLayout,
    @NonNull int startId,
    @NonNull int endId
)

Called when a drawer is about to start a transition.

@Override @NonNull void
onTransitionTrigger(
    @NonNull MotionLayout motionLayout,
    @NonNull int triggerId,
    @NonNull boolean positive,
    @NonNull float progress
)

Call when a trigger is fired

Public methods

onTransitionChange

@Override
@NonNull
public @Override void onTransitionChange(
    @NonNull MotionLayout motionLayout,
    @NonNull int startId,
    @NonNull int endId,
    @NonNull float progress
)

Called when a drawer's position changes.

Parameters
@NonNull MotionLayout motionLayout

The TransitionLayout view that was moved

@NonNull int startId

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

@NonNull int endId

the id of the end state (or ConstraintSet).

@NonNull float progress

The progress on this transition, from 0 to 1.

onTransitionCompleted

@Override
@NonNull
public @Override void onTransitionCompleted(
    @NonNull MotionLayout motionLayout,
    @NonNull int currentId
)

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

Parameters
@NonNull MotionLayout motionLayout

Drawer view that is now open

@NonNull int currentId

the id it has reached

onTransitionStarted

@Override
@NonNull
public @Override void onTransitionStarted(
    @NonNull MotionLayout motionLayout,
    @NonNull int startId,
    @NonNull int endId
)

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

Parameters
@NonNull MotionLayout motionLayout

The TransitionLayout view that was moved

@NonNull int startId

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

@NonNull int endId

the id of the end state (or ConstraintSet).

onTransitionTrigger

@Override
@NonNull
public @Override void onTransitionTrigger(
    @NonNull MotionLayout motionLayout,
    @NonNull int triggerId,
    @NonNull boolean positive,
    @NonNull float progress
)

Call when a trigger is fired

Parameters
@NonNull MotionLayout motionLayout
@NonNull int triggerId

The id set set with triggerID

@NonNull boolean positive

for positive transition edge

@NonNull float progress