interface WindowInsetsAnimationController
Controller for app-driven animation of system windows.
WindowInsetsAnimationController lets apps animate system windows such as the IME. The animation is synchronized, such that changes the system windows and the app's current frame are rendered at the same time.
Control is obtained through WindowInsetsController.controlWindowInsetsAnimation.
Summary
| Public methods | |
|---|---|
| abstract Unit |
Finishes the animation, and leaves the windows shown or hidden. |
| abstract Float |
Current alpha value of the window. |
| abstract Float |
Returns the progress as previously set by |
| abstract Insets |
Retrieves the current insets. |
| abstract Insets |
Retrieves the |
| abstract Insets |
Retrieves the |
| abstract Int |
|
| abstract Boolean |
Returns whether this instance has been cancelled by the system, or by invoking the |
| abstract Boolean |
Returns whether this instance has been finished by a call to |
| open Boolean |
Returns whether this instance is ready to be used to control window insets. |
| abstract Unit |
Modifies the insets for the frame being drawn by indirectly moving the windows around in the system that are causing window insets. |
Public methods
finish
abstract fun finish(shown: Boolean): Unit
Finishes the animation, and leaves the windows shown or hidden.
After invoking finish, this instance is no longer ready.
Note: Finishing an animation implicitly sets insets and alpha according to the requested end state without any further animation.
| Parameters | |
|---|---|
shown |
Boolean: if true, the windows will be shown after finishing the animation. Otherwise they will be hidden. |
getCurrentAlpha
abstract fun getCurrentAlpha(): Float
Current alpha value of the window.
| Return | |
|---|---|
Float |
float value between 0 and 1. |
getCurrentFraction
abstract fun getCurrentFraction(): Float
Returns the progress as previously set by fraction in setInsetsAndAlpha
| Return | |
|---|---|
Float |
the progress of the animation, where 0 is fully hidden and 1 is fully shown.
Note: this value represents raw overall progress of the animation i.e. the combined progress of insets and alpha. . |
getCurrentInsets
abstract fun getCurrentInsets(): Insets
Retrieves the current insets.
Note that these insets are always relative to the window, which is the same as being relative to View.getRootView
| Return | |
|---|---|
Insets |
The current insets on the currently showing frame. These insets will change as the animation progresses to reflect the current insets provided by the controlled window. This value cannot be null. |
getHiddenStateInsets
abstract fun getHiddenStateInsets(): Insets
Retrieves the Insets when the windows this animation is controlling are fully hidden.
Note that these insets are always relative to the window, which is the same as being relative to View.getRootView
If there are any animation listeners registered, this value is the same as Bounds.getLowerBound() that is being be passed into the root view of the hierarchy.
| Return | |
|---|---|
Insets |
Insets when the windows this animation is controlling are fully hidden. This value cannot be null. |
getShownStateInsets
abstract fun getShownStateInsets(): Insets
Retrieves the Insets when the windows this animation is controlling are fully shown.
Note that these insets are always relative to the window, which is the same as being relative to View.getRootView
If there are any animation listeners registered, this value is the same as Bounds.getUpperBound() that is being passed into the root view of hierarchy.
| Return | |
|---|---|
Insets |
Insets when the windows this animation is controlling are fully shown. This value cannot be null. |
getTypes
abstract fun getTypes(): Int
| Return | |
|---|---|
Int |
The WindowInsets.Types this object is currently controlling. Value is either 0 or a combination of the following:
|
isFinished
abstract fun isFinished(): Boolean
Returns whether this instance has been finished by a call to finish.
| Return | |
|---|---|
Boolean |
true if the instance is finished, false otherwise. |
isReady
open fun isReady(): Boolean
Returns whether this instance is ready to be used to control window insets.
Instances are ready when passed in WindowInsetsAnimationControlListener.onReady and stop being ready when it is either finished or cancelled.
| Return | |
|---|---|
Boolean |
true if the instance is ready, false otherwise. |