WindowInsetsAnimationControllerCompat

public final class WindowInsetsAnimationControllerCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.WindowInsetsAnimationControllerCompat


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 WindowInsetsControllerCompat.controlWindowInsetsAnimation(int, long, Interpolator, CancellationSignal, WindowInsetsAnimationControlListenerCompat).

Summary

Public methods

void finish(boolean shown)

Finishes the animation, and leaves the windows shown or hidden.

float getCurrentAlpha()

Current alpha value of the window.

float getCurrentFraction()

Returns the progress as previously set by fraction in setInsetsAndAlpha(Insets, float, float)

Insets getCurrentInsets()

Retrieves the current insets.

Insets getHiddenStateInsets()

Retrieves the Insets when the windows this animation is controlling are fully hidden.

Insets getShownStateInsets()

Retrieves the Insets when the windows this animation is controlling are fully shown.

int getTypes()
boolean isCancelled()

Returns whether this instance has been cancelled by the system, or by invoking the CancellationSignal passed into WindowInsetsControllerCompat.controlWindowInsetsAnimation(int, long, Interpolator, CancellationSignal, WindowInsetsAnimationControlListenerCompat).

boolean isFinished()

Returns whether this instance has been finished by a call to finish(boolean).

boolean isReady()

Returns whether this instance is ready to be used to control window insets.

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.

Inherited methods

Public methods

finish

public 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 float getCurrentAlpha ()

Current alpha value of the window.

Returns
float float value between 0 and 1.

getCurrentFraction

public 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.

Value is between 0.0 and 1.0 inclusive.

getCurrentInsets

public 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.

getHiddenStateInsets

public 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 WindowInsetsAnimationCompat.BoundsCompat.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.

getShownStateInsets

public 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 WindowInsetsAnimationCompat.BoundsCompat.getUpperBound() that is being passed into the root view of hierarchy.

Returns
Insets Insets when the windows this animation is controlling are fully shown.

See also: