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

*** ** * ** ***


```
public interface MotionHelperInterface extends Animatable, MotionLayout.TransitionListener
```

<br />

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

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

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

|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/helper/widget/Carousel` | Carousel works within a MotionLayout to provide a simple recycler like pattern. |
| `https://developer.android.com/reference/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 methods |
|---|---|
| `abstract boolean` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#isDecorator()()` is involved in painting |
| `abstract boolean` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#isUseOnHide()()` Notify when views are hidden |
| `abstract boolean` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#isUsedOnShow()()` Notify when view is visible |
| `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#onFinishedMotionScene(androidx.constraintlayout.motion.widget.MotionLayout)(https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout)` This is called after motionLayout read motionScene and assembles all constraintSets |
| `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPostDraw(android.graphics.Canvas)(https://developer.android.com/reference/android/graphics/Canvas.html canvas)` Called after views are painted |
| `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPreDraw(android.graphics.Canvas)(https://developer.android.com/reference/android/graphics/Canvas.html canvas)` Call before views are painted |
| `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionHelperInterface#onPreSetup(androidx.constraintlayout.motion.widget.MotionLayout,java.util.HashMap<android.view.View,androidx.constraintlayout.motion.widget.MotionController>)( https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout motionLayout, https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/android/view/View.html, https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionController> controllerMap )` Called after motionController is populated with start and end and keyframes. |

| ### Inherited methods |
|---|
| From [androidx.constraintlayout.motion.widget.Animatable](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Animatable) |---|---| | `abstract float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Animatable#getProgress()()` get the progress | | `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Animatable#setProgress(float)(float progress)` Set the progress | |
| From [androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener) |---|---| | `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener#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. | | `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener#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. | | `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener#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. | | `abstract void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout.TransitionListener#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 methods

### isDecorator

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

```
abstract boolean isDecorator()
```

is involved in painting

| Returns |
|---|---|
| `boolean` |   |

### isUseOnHide

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

```
abstract boolean isUseOnHide()
```

Notify when views are hidden

| Returns |
|---|---|
| `boolean` |   |

### isUsedOnShow

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

```
abstract boolean isUsedOnShow()
```

Notify when view is visible

| Returns |
|---|---|
| `boolean` |   |

### onFinishedMotionScene

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

```
abstract void onFinishedMotionScene(MotionLayout motionLayout)
```

This is called after motionLayout read motionScene and assembles all constraintSets

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

### onPostDraw

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

```
abstract void onPostDraw(Canvas canvas)
```

Called after views are painted

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

### onPreDraw

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

```
abstract void onPreDraw(Canvas canvas)
```

Call before views are painted

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

### onPreSetup

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

```
abstract void onPreSetup(
    MotionLayout motionLayout,
    HashMap<View, MotionController> controllerMap
)
```

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

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