# 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)

*** ** * ** ***


```
abstract class TransitionAdapter : MotionLayout.TransitionListener
```

<br />

*** ** * ** ***

## Summary

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

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

## Public constructors

### TransitionAdapter

Added in 2.2.2

```
TransitionAdapter()
```

## Public functions

### onTransitionChange

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

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

Called when a drawer's position changes.

| Parameters |
|---|---|
| `motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` | The TransitionLayout view that was moved |
| `startId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the start state (or ConstraintSet). Will be -1 if unknown. |
| `endId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the end state (or ConstraintSet). |
| `progress: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | 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)

```
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: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` | Drawer view that is now open |
| `currentId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id it has reached |

### onTransitionStarted

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

```
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: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` | The TransitionLayout view that was moved |
| `startId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the id of the start state (or ConstraintSet). Will be -1 if unknown. |
| `endId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | 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)

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

Call when a trigger is fired

| Parameters |
|---|---|
| `motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` |   |
| `triggerId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The id set set with triggerID |
| `positive: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | for positive transition edge |
| `progress: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |