Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# WindowInsetsAnimationControlListener

*** ** * ** ***


`
public


interface
WindowInsetsAnimationControlListener
`


`


`

|---|
| android.view.WindowInsetsAnimationControlListener |

<br />

*** ** * ** ***

Listener that encapsulates a request to
`https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)`.


Insets can be controlled with the supplied `https://developer.android.com/reference/android/view/WindowInsetsAnimationController` from
`https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onReady(android.view.WindowInsetsAnimationController,%20int)` until either `https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onFinished(android.view.WindowInsetsAnimationController)` or `https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onCancelled(android.view.WindowInsetsAnimationController)`.


Once the control over insets is finished or cancelled, it will not be regained until a new
request to `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` is made.


The request to control insets can fail immediately. In that case `https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onCancelled(android.view.WindowInsetsAnimationController)` will be
invoked without a preceding `https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onReady(android.view.WindowInsetsAnimationController,%20int)`.
**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)`

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onCancelled(android.view.WindowInsetsAnimationController)(https://developer.android.com/reference/android/view/WindowInsetsAnimationController controller) ` Called when the request for control over the insets has been cancelled, either because the `https://developer.android.com/reference/android/os/CancellationSignal` associated with the `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` has been invoked, or the window has lost control over the insets (e.g. because it lost focus). |
| ` abstract void` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onFinished(android.view.WindowInsetsAnimationController)(https://developer.android.com/reference/android/view/WindowInsetsAnimationController controller) ` Called when the request for control over the insets has `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#finish(boolean)`. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onReady(android.view.WindowInsetsAnimationController,%20int)(https://developer.android.com/reference/android/view/WindowInsetsAnimationController controller, int types) ` Called when the animation is ready to be controlled. |

## Public methods

### onCancelled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onCancelled (WindowInsetsAnimationController controller)
```

Called when the request for control over the insets has been cancelled, either
because the `https://developer.android.com/reference/android/os/CancellationSignal` associated with the
`https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` has been invoked, or
the window has lost control over the insets (e.g. because it lost focus).

Once this callback is invoked, the supplied `https://developer.android.com/reference/android/view/WindowInsetsAnimationController`
is no longer `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#isReady()`.

Control will not be regained until a new request
to `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` is made.

<br />

| Parameters ||
|---|---|
| `controller` | `WindowInsetsAnimationController`: the controller which has been cancelled, or null if the request was cancelled before `https://developer.android.com/reference/android/view/WindowInsetsAnimationControlListener#onReady(android.view.WindowInsetsAnimationController,%20int)` was invoked. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#isCancelled()`

### onFinished

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onFinished (WindowInsetsAnimationController controller)
```

Called when the request for control over the insets has
`https://developer.android.com/reference/android/view/WindowInsetsAnimationController#finish(boolean)`.

Once this callback is invoked, the supplied `https://developer.android.com/reference/android/view/WindowInsetsAnimationController`
is no longer `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#isReady()`.

Control will not be regained until a new request
to `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` is made.

<br />

| Parameters ||
|---|---|
| `controller` | `WindowInsetsAnimationController`: the controller which has finished. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#isFinished()`

### onReady

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onReady (WindowInsetsAnimationController controller, 
                int types)
```

Called when the animation is ready to be controlled. This may be delayed when the IME needs
to redraw because of an `https://developer.android.com/reference/android/view/inputmethod/EditorInfo` change, or when the window is starting up.

<br />

| Parameters ||
|---|---|
| `controller` | `WindowInsetsAnimationController`: The controller to control the inset animation. This value cannot be `null`. <br /> |
| `types` | `int`: The `https://developer.android.com/reference/android/view/WindowInsets.Type`s it was able to gain control over. Note that this may be different than the types passed into `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)` in case the window wasn't able to gain the controls because it wasn't the IME target or not currently the window that's controlling the system bars. Value is either `0` or a combination of the following: |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#isReady()`