# TransitionAdapter

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/motion/widget/TransitionAdapter.java+class:androidx.constraintlayout.motion.widget.TransitionAdapter) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
public abstract class TransitionAdapter implements MotionLayout.TransitionListener
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/TransitionAdapter#TransitionAdapter()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/TransitionAdapter#onTransitionChange(androidx.constraintlayout.motion.widget.MotionLayout,int,int,float)( https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout, int startId, int endId, float progress )` Called when a drawer's position changes. |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/TransitionAdapter#onTransitionCompleted(androidx.constraintlayout.motion.widget.MotionLayout,int)(https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout, int currentId)` Called when a drawer has settled completely a state. |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/TransitionAdapter#onTransitionStarted(androidx.constraintlayout.motion.widget.MotionLayout,int,int)(https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout, int startId, int endId)` Called when a drawer is about to start a transition. |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/TransitionAdapter#onTransitionTrigger(androidx.constraintlayout.motion.widget.MotionLayout,int,boolean,float)( https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout, int triggerId, boolean positive, float progress )` Call when a trigger is fired |

## Public constructors

### TransitionAdapter

Added in 2.2.2

```
public TransitionAdapter()
```

## Public methods

### onTransitionChange

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

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

Called when a drawer's position changes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout` | The TransitionLayout view that was moved |
| `int startId` | the id of the start state (or ConstraintSet). Will be -1 if unknown. |
| `int endId` | the id of the end state (or ConstraintSet). |
| `float progress` | The progress on this transition, from 0 to 1. |

### onTransitionCompleted

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public void onTransitionCompleted(MotionLayout motionLayout, int currentId)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout` | Drawer view that is now open |
| `int currentId` | the id it has reached |

### onTransitionStarted

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public 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 |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout` | The TransitionLayout view that was moved |
| `int startId` | the id of the start state (or ConstraintSet). Will be -1 if unknown. |
| `int endId` | the id of the end state (or ConstraintSet). |

### onTransitionTrigger

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

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

Call when a trigger is fired

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout` |   |
| `int triggerId` | The id set set with triggerID |
| `boolean positive` | for positive transition edge |
| `float progress` |   |