# MotionHelperInterface

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/MotionHelperInterface.java+class:androidx.constraintlayout.motion.widget.MotionHelperInterface) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
interface MotionHelperInterface : Animatable, MotionLayout.TransitionListener
```

<br />

Known direct subclasses [MotionHelper](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelper)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelper` |   |

Known indirect subclasses [Carousel](https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/Carousel), [MotionEffect](https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/MotionEffect)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/Carousel` | Carousel works within a MotionLayout to provide a simple recycler like pattern. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/helper/widget/MotionEffect` | MotionHelper that automatically inserts keyframes for views moving in a given direction, out of: |

*** ** * ** ***

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

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#isDecorator()()` is involved in painting |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#isUseOnHide()()` Notify when views are hidden |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#isUsedOnShow()()` Notify when view is visible |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#onFinishedMotionScene(androidx.constraintlayout.motion.widget.MotionLayout)(motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!)` This is called after motionLayout read motionScene and assembles all constraintSets |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPostDraw(android.graphics.Canvas)(canvas: https://developer.android.com/reference/android/graphics/Canvas.html!)` Called after views are painted |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPreDraw(android.graphics.Canvas)(canvas: https://developer.android.com/reference/android/graphics/Canvas.html!)` Call before views are painted |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPreSetup(androidx.constraintlayout.motion.widget.MotionLayout,java.util.HashMap<android.view.View,androidx.constraintlayout.motion.widget.MotionController>)( motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!, controllerMap: https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/android/view/View.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionController!>! )` Called after motionController is populated with start and end and keyframes. |

| ### Inherited functions |
|---|
| From [androidx.constraintlayout.motion.widget.Animatable](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Animatable) |---|---| | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Animatable#getProgress()()` get the progress | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Animatable#setProgress(float)(progress: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the progress | |
| From [androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener) |---|---| | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener#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/MotionLayout.TransitionListener#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/MotionLayout.TransitionListener#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/MotionLayout.TransitionListener#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 functions

### isDecorator

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

```
fun isDecorator(): Boolean
```

is involved in painting

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` |   |

### isUseOnHide

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

```
fun isUseOnHide(): Boolean
```

Notify when views are hidden

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` |   |

### isUsedOnShow

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

```
fun isUsedOnShow(): Boolean
```

Notify when view is visible

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` |   |

### onFinishedMotionScene

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

```
fun onFinishedMotionScene(motionLayout: MotionLayout!): Unit
```

This is called after motionLayout read motionScene and assembles all constraintSets

| Parameters |
|---|---|
| `motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` |   |

### onPostDraw

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

```
fun onPostDraw(canvas: Canvas!): Unit
```

Called after views are painted

| Parameters |
|---|---|
| `canvas: https://developer.android.com/reference/android/graphics/Canvas.html!` |   |

### onPreDraw

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

```
fun onPreDraw(canvas: Canvas!): Unit
```

Call before views are painted

| Parameters |
|---|---|
| `canvas: https://developer.android.com/reference/android/graphics/Canvas.html!` |   |

### onPreSetup

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

```
fun onPreSetup(
    motionLayout: MotionLayout!,
    controllerMap: HashMap<View!, MotionController!>!
): Unit
```

Called after motionController is populated with start and end and keyframes.

| Parameters |
|---|---|
| `motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` |   |
| `controllerMap: https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/android/view/View.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionController!>!` |   |