WindowInsetsAnimationController | API reference | Android Developers
public
interface
WindowInsetsAnimationController
android.view.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
void
|
finish(boolean shown)
Finishes the animation, and leaves the windows shown or hidden. |
abstract
float
|
getCurrentAlpha()
Current alpha value of the window. |
abstract
float
|
getCurrentFraction()
Returns the progress as previously set by |
abstract
Insets
|
getCurrentInsets()
Retrieves the current insets. |
abstract
Insets
|
getHiddenStateInsets()
Retrieves the |
abstract
Insets
|
getShownStateInsets()
Retrieves the |
abstract
int
|
getTypes()
|
abstract
boolean
|
isCancelled()
Returns whether this instance has been cancelled by the system, or by invoking the
|
abstract
boolean
|
isFinished()
Returns whether this instance has been finished by a call to |
default
boolean
|
isReady()
Returns whether this instance is ready to be used to control window insets. |
abstract
void
|
setInsetsAndAlpha(Insets insets, float alpha, float fraction)
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
public abstract void finish (boolean shown)
Finishes the animation, and leaves the windows shown or hidden.
After invoking finish(boolean), 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
public abstract float getCurrentAlpha ()
Current alpha value of the window.
| Returns | |
|---|---|
float |
float value between 0 and 1. |
getCurrentFraction
public abstract float getCurrentFraction ()
Returns the progress as previously set by fraction in setInsetsAndAlpha(Insets, float, float)
| Returns | |
|---|---|
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
public abstract Insets getCurrentInsets ()
Retrieves the current insets.
Note that these insets are always relative to the window, which is the same as
being relative
to View.getRootView
| Returns | |
|---|---|
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
public abstract Insets getHiddenStateInsets ()
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.
| Returns | |
|---|---|
Insets |
Insets when the windows this animation is controlling are fully hidden.
This value cannot be null. |
getShownStateInsets
public abstract Insets getShownStateInsets ()
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.
| Returns | |
|---|---|
Insets |
Insets when the windows this animation is controlling are fully shown.
This value cannot be null. |
getTypes
public abstract int getTypes ()
| Returns | |
|---|---|
int |
The WindowInsets.Types this object is currently controlling.
Value is either 0 or a combination of the following:
|
isFinished
public abstract boolean isFinished ()
Returns whether this instance has been finished by a call to finish(boolean).
| Returns | |
|---|---|
boolean |
true if the instance is finished, false otherwise. |
isReady
public boolean isReady ()
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.
| Returns | |
|---|---|
boolean |
true if the instance is ready, false otherwise. |