diff options
| -rw-r--r-- | core/java/android/view/WindowInsetsAnimationController.java | 21 | ||||
| -rw-r--r-- | core/java/android/view/WindowInsetsAnimationListener.java | 8 |
2 files changed, 26 insertions, 3 deletions
diff --git a/core/java/android/view/WindowInsetsAnimationController.java b/core/java/android/view/WindowInsetsAnimationController.java index 9de517dac5de..cf4415d2b2ba 100644 --- a/core/java/android/view/WindowInsetsAnimationController.java +++ b/core/java/android/view/WindowInsetsAnimationController.java @@ -19,6 +19,7 @@ package android.view; import android.annotation.NonNull; import android.graphics.Insets; import android.view.WindowInsets.Type.InsetType; +import android.view.WindowInsetsAnimationListener.InsetsAnimation; /** * Interface to control a window inset animation frame-by-frame. @@ -28,8 +29,13 @@ public interface WindowInsetsAnimationController { /** * Retrieves the {@link Insets} when the windows this animation is controlling are fully hidden. + * <p> + * If there are any animation listeners registered, this value is the same as + * {@link InsetsAnimation#getLowerBound()} that will be passed into the callbacks. * * @return Insets when the windows this animation is controlling are fully hidden. + * + * @see InsetsAnimation#getLowerBound() */ @NonNull Insets getHiddenStateInsets(); @@ -38,8 +44,13 @@ public interface WindowInsetsAnimationController { * <p> * In case the size of a window causing insets is changing in the middle of the animation, we * execute that height change after this animation has finished. + * <p> + * If there are any animation listeners registered, this value is the same as + * {@link InsetsAnimation#getUpperBound()} that will be passed into the callbacks. * * @return Insets when the windows this animation is controlling are fully shown. + * + * @see InsetsAnimation#getUpperBound() */ @NonNull Insets getShownStateInsets(); @@ -59,8 +70,11 @@ public interface WindowInsetsAnimationController { * <p> * Note that this will <b>not</b> inform the view system of a full inset change via * {@link View#dispatchApplyWindowInsets} in order to avoid a full layout pass during the - * animation. If you'd like to animate views during a window inset animation, use - * TODO add link to animation listeners. + * animation. If you'd like to animate views during a window inset animation, register a + * {@link WindowInsetsAnimationListener} by calling + * {@link View#setWindowInsetsAnimationListener(WindowInsetsAnimationListener)} that will be + * notified about any insets change via {@link WindowInsetsAnimationListener#onProgress} during + * the animation. * <p> * {@link View#dispatchApplyWindowInsets} will instead be called once the animation has * finished, i.e. once {@link #finish} has been called. @@ -70,6 +84,9 @@ public interface WindowInsetsAnimationController { * the resulting insets of that configuration will match the passed in parameter. * Note that these insets are being clamped to the range from * {@link #getHiddenStateInsets} to {@link #getShownStateInsets} + * + * @see WindowInsetsAnimationListener + * @see View#setWindowInsetsAnimationListener(WindowInsetsAnimationListener) */ void changeInsets(@NonNull Insets insets); diff --git a/core/java/android/view/WindowInsetsAnimationListener.java b/core/java/android/view/WindowInsetsAnimationListener.java index 2b44e2977533..682ab5bfb63c 100644 --- a/core/java/android/view/WindowInsetsAnimationListener.java +++ b/core/java/android/view/WindowInsetsAnimationListener.java @@ -84,7 +84,11 @@ public interface WindowInsetsAnimationListener { /** * Queries the lower inset bound of the animation. If the animation is about showing or * hiding a window that cause insets, the lower bound is {@link Insets#NONE} and the upper - * bound is the same as {@link WindowInsets#getInsets(int)} for the fully shown state. + * bound is the same as {@link WindowInsets#getInsets(int)} for the fully shown state. This + * is the same as {@link WindowInsetsAnimationController#getHiddenStateInsets} and + * {@link WindowInsetsAnimationController#getShownStateInsets} in case the listener gets + * invoked because of an animation that originates from + * {@link WindowInsetsAnimationController}. * <p> * However, if the size of a window that causes insets is changing, these are the * lower/upper bounds of that size animation. @@ -93,6 +97,7 @@ public interface WindowInsetsAnimationListener { * running at the same time for different inset types. * * @see #getUpperBound() + * @see WindowInsetsAnimationController#getHiddenStateInsets * TODO: It's a bit weird that these are global per window but onProgress is hierarchical. * TODO: If multiple types are animating, querying the bound per type isn't possible. Should * we: @@ -108,6 +113,7 @@ public interface WindowInsetsAnimationListener { /** * @see #getLowerBound() + * @see WindowInsetsAnimationController#getShownStateInsets */ public Insets getUpperBound() { return mUpperBound; |