Loading api/current.txt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -55572,7 +55572,8 @@ package android.view { } } public interface WindowInsetsAnimationControlListener { public interface WindowInsetsAnimationControlListener { method public void onCancelled(); method public void onCancelled(@Nullable android.view.WindowInsetsAnimationController); method public void onFinished(@NonNull android.view.WindowInsetsAnimationController); method public void onReady(@NonNull android.view.WindowInsetsAnimationController, int); method public void onReady(@NonNull android.view.WindowInsetsAnimationController, int); } } Loading @@ -55584,6 +55585,9 @@ package android.view { method @NonNull public android.graphics.Insets getHiddenStateInsets(); method @NonNull public android.graphics.Insets getHiddenStateInsets(); method @NonNull public android.graphics.Insets getShownStateInsets(); method @NonNull public android.graphics.Insets getShownStateInsets(); method public int getTypes(); method public int getTypes(); method public boolean isCancelled(); method public boolean isFinished(); method public default boolean isReady(); method public void setInsetsAndAlpha(@Nullable android.graphics.Insets, @FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float); method public void setInsetsAndAlpha(@Nullable android.graphics.Insets, @FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float); } } core/java/android/view/InsetsAnimationControlImpl.java +8 −1 Original line number Original line Diff line number Diff line Loading @@ -200,6 +200,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } } setInsetsAndAlpha(shown ? mShownInsets : mHiddenInsets, 1f /* alpha */, 1f /* fraction */); setInsetsAndAlpha(shown ? mShownInsets : mHiddenInsets, 1f /* alpha */, 1f /* fraction */); mFinished = true; mFinished = true; mListener.onFinished(this); mShownOnFinish = shown; mShownOnFinish = shown; } } Loading @@ -216,11 +217,17 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return; return; } } mCancelled = true; mCancelled = true; mListener.onCancelled(); mListener.onCancelled(this); releaseLeashes(); releaseLeashes(); } } @Override public boolean isFinished() { return mFinished; } @Override public boolean isCancelled() { public boolean isCancelled() { return mCancelled; return mCancelled; } } Loading core/java/android/view/InsetsController.java +9 −5 Original line number Original line Diff line number Diff line Loading @@ -213,7 +213,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } @Override @Override public void onCancelled() { public void onFinished(WindowInsetsAnimationController controller) { } @Override public void onCancelled(WindowInsetsAnimationController controller) { // Animator can be null when it is cancelled before onReady() completes. // Animator can be null when it is cancelled before onReady() completes. if (mAnimator != null) { if (mAnimator != null) { mAnimator.cancel(); mAnimator.cancel(); Loading Loading @@ -583,7 +587,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation boolean fromIme, long durationMs, @Nullable Interpolator interpolator, boolean fromIme, long durationMs, @Nullable Interpolator interpolator, @AnimationType int animationType) { @AnimationType int animationType) { if (!checkDisplayFramesForControlling()) { if (!checkDisplayFramesForControlling()) { listener.onCancelled(); listener.onCancelled(null); return; return; } } controlAnimationUnchecked(types, cancellationSignal, listener, mFrame, fromIme, durationMs, controlAnimationUnchecked(types, cancellationSignal, listener, mFrame, fromIme, durationMs, Loading @@ -608,7 +612,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation boolean useInsetsAnimationThread) { boolean useInsetsAnimationThread) { if (types == 0) { if (types == 0) { // nothing to animate. // nothing to animate. listener.onCancelled(); listener.onCancelled(null); return; return; } } cancelExistingControllers(types); cancelExistingControllers(types); Loading Loading @@ -641,7 +645,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } if (typesReady == 0) { if (typesReady == 0) { listener.onCancelled(); listener.onCancelled(null); return; return; } } Loading Loading @@ -756,7 +760,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private void abortPendingImeControlRequest() { private void abortPendingImeControlRequest() { if (mPendingImeControlRequest != null) { if (mPendingImeControlRequest != null) { mPendingImeControlRequest.listener.onCancelled(); mPendingImeControlRequest.listener.onCancelled(null); mPendingImeControlRequest = null; mPendingImeControlRequest = null; mHandler.removeCallbacks(mPendingControlTimeout); mHandler.removeCallbacks(mPendingControlTimeout); } } Loading core/java/android/view/PendingInsetsController.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -172,7 +172,7 @@ public class PendingInsetsController implements WindowInsetsController { mReplayedInsetsController.controlWindowInsetsAnimation(types, durationMillis, mReplayedInsetsController.controlWindowInsetsAnimation(types, durationMillis, interpolator, cancellationSignal, listener); interpolator, cancellationSignal, listener); } else { } else { listener.onCancelled(); listener.onCancelled(null); } } } } Loading core/java/android/view/WindowInsetsAnimationControlListener.java +48 −12 Original line number Original line Diff line number Diff line Loading @@ -17,20 +17,30 @@ package android.view; package android.view; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsets.Type.InsetsType; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo; /** /** * Interface that informs the client about {@link WindowInsetsAnimationController} state changes. * Listener that encapsulates a request to * {@link WindowInsetsController#controlWindowInsetsAnimation}. * * <p> * Insets can be controlled with the supplied {@link WindowInsetsAnimationController} from * {@link #onReady} until either {@link #onFinished} or {@link #onCancelled}. * * <p> * Once the control over insets is finished or cancelled, it will not be regained until a new * request to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * <p> * The request to control insets can fail immediately. In that case {@link #onCancelled} will be * invoked without a preceding {@link #onReady}. * * @see WindowInsetsController#controlWindowInsetsAnimation */ */ public interface WindowInsetsAnimationControlListener { public interface WindowInsetsAnimationControlListener { /** * @hide */ default void onPrepare(int types) { } /** /** * Called when the animation is ready to be controlled. This may be delayed when the IME needs * Called when the animation is ready to be controlled. This may be delayed when the IME needs * to redraw because of an {@link EditorInfo} change, or when the window is starting up. * to redraw because of an {@link EditorInfo} change, or when the window is starting up. Loading @@ -41,14 +51,40 @@ public interface WindowInsetsAnimationControlListener { * {@link WindowInsetsController#controlWindowInsetsAnimation} in case the window * {@link WindowInsetsController#controlWindowInsetsAnimation} in case the window * wasn't able to gain the controls because it wasn't the IME target or not * 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. * currently the window that's controlling the system bars. * @see WindowInsetsAnimationController#isReady */ */ void onReady(@NonNull WindowInsetsAnimationController controller, @InsetsType int types); void onReady(@NonNull WindowInsetsAnimationController controller, @InsetsType int types); /** /** * Called when the window no longer has control over the requested types. If it loses control * Called when the request for control over the insets has * over one type, the whole control will be cancelled. If none of the requested types were * {@link WindowInsetsAnimationController#finish finished}. * available when requesting the control, the animation control will be cancelled immediately * * without {@link #onReady} being called. * Once this callback is invoked, the supplied {@link WindowInsetsAnimationController} * is no longer {@link WindowInsetsAnimationController#isReady() ready}. * * Control will not be regained until a new request * to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * @param controller the controller which has finished. * @see WindowInsetsAnimationController#isFinished */ void onFinished(@NonNull WindowInsetsAnimationController controller); /** * Called when the request for control over the insets has been cancelled, either * because the {@link android.os.CancellationSignal} associated with the * {@link WindowInsetsController#controlWindowInsetsAnimation request} 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 {@link WindowInsetsAnimationController} * is no longer {@link WindowInsetsAnimationController#isReady() ready}. * * Control will not be regained until a new request * to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * @param controller the controller which has been cancelled, or null if the request * was cancelled before {@link #onReady} was invoked. * @see WindowInsetsAnimationController#isCancelled */ */ void onCancelled(); void onCancelled(@Nullable WindowInsetsAnimationController controller); } } Loading
api/current.txt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -55572,7 +55572,8 @@ package android.view { } } public interface WindowInsetsAnimationControlListener { public interface WindowInsetsAnimationControlListener { method public void onCancelled(); method public void onCancelled(@Nullable android.view.WindowInsetsAnimationController); method public void onFinished(@NonNull android.view.WindowInsetsAnimationController); method public void onReady(@NonNull android.view.WindowInsetsAnimationController, int); method public void onReady(@NonNull android.view.WindowInsetsAnimationController, int); } } Loading @@ -55584,6 +55585,9 @@ package android.view { method @NonNull public android.graphics.Insets getHiddenStateInsets(); method @NonNull public android.graphics.Insets getHiddenStateInsets(); method @NonNull public android.graphics.Insets getShownStateInsets(); method @NonNull public android.graphics.Insets getShownStateInsets(); method public int getTypes(); method public int getTypes(); method public boolean isCancelled(); method public boolean isFinished(); method public default boolean isReady(); method public void setInsetsAndAlpha(@Nullable android.graphics.Insets, @FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float); method public void setInsetsAndAlpha(@Nullable android.graphics.Insets, @FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float); } }
core/java/android/view/InsetsAnimationControlImpl.java +8 −1 Original line number Original line Diff line number Diff line Loading @@ -200,6 +200,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } } setInsetsAndAlpha(shown ? mShownInsets : mHiddenInsets, 1f /* alpha */, 1f /* fraction */); setInsetsAndAlpha(shown ? mShownInsets : mHiddenInsets, 1f /* alpha */, 1f /* fraction */); mFinished = true; mFinished = true; mListener.onFinished(this); mShownOnFinish = shown; mShownOnFinish = shown; } } Loading @@ -216,11 +217,17 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return; return; } } mCancelled = true; mCancelled = true; mListener.onCancelled(); mListener.onCancelled(this); releaseLeashes(); releaseLeashes(); } } @Override public boolean isFinished() { return mFinished; } @Override public boolean isCancelled() { public boolean isCancelled() { return mCancelled; return mCancelled; } } Loading
core/java/android/view/InsetsController.java +9 −5 Original line number Original line Diff line number Diff line Loading @@ -213,7 +213,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } @Override @Override public void onCancelled() { public void onFinished(WindowInsetsAnimationController controller) { } @Override public void onCancelled(WindowInsetsAnimationController controller) { // Animator can be null when it is cancelled before onReady() completes. // Animator can be null when it is cancelled before onReady() completes. if (mAnimator != null) { if (mAnimator != null) { mAnimator.cancel(); mAnimator.cancel(); Loading Loading @@ -583,7 +587,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation boolean fromIme, long durationMs, @Nullable Interpolator interpolator, boolean fromIme, long durationMs, @Nullable Interpolator interpolator, @AnimationType int animationType) { @AnimationType int animationType) { if (!checkDisplayFramesForControlling()) { if (!checkDisplayFramesForControlling()) { listener.onCancelled(); listener.onCancelled(null); return; return; } } controlAnimationUnchecked(types, cancellationSignal, listener, mFrame, fromIme, durationMs, controlAnimationUnchecked(types, cancellationSignal, listener, mFrame, fromIme, durationMs, Loading @@ -608,7 +612,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation boolean useInsetsAnimationThread) { boolean useInsetsAnimationThread) { if (types == 0) { if (types == 0) { // nothing to animate. // nothing to animate. listener.onCancelled(); listener.onCancelled(null); return; return; } } cancelExistingControllers(types); cancelExistingControllers(types); Loading Loading @@ -641,7 +645,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } if (typesReady == 0) { if (typesReady == 0) { listener.onCancelled(); listener.onCancelled(null); return; return; } } Loading Loading @@ -756,7 +760,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private void abortPendingImeControlRequest() { private void abortPendingImeControlRequest() { if (mPendingImeControlRequest != null) { if (mPendingImeControlRequest != null) { mPendingImeControlRequest.listener.onCancelled(); mPendingImeControlRequest.listener.onCancelled(null); mPendingImeControlRequest = null; mPendingImeControlRequest = null; mHandler.removeCallbacks(mPendingControlTimeout); mHandler.removeCallbacks(mPendingControlTimeout); } } Loading
core/java/android/view/PendingInsetsController.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -172,7 +172,7 @@ public class PendingInsetsController implements WindowInsetsController { mReplayedInsetsController.controlWindowInsetsAnimation(types, durationMillis, mReplayedInsetsController.controlWindowInsetsAnimation(types, durationMillis, interpolator, cancellationSignal, listener); interpolator, cancellationSignal, listener); } else { } else { listener.onCancelled(); listener.onCancelled(null); } } } } Loading
core/java/android/view/WindowInsetsAnimationControlListener.java +48 −12 Original line number Original line Diff line number Diff line Loading @@ -17,20 +17,30 @@ package android.view; package android.view; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsets.Type.InsetsType; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo; /** /** * Interface that informs the client about {@link WindowInsetsAnimationController} state changes. * Listener that encapsulates a request to * {@link WindowInsetsController#controlWindowInsetsAnimation}. * * <p> * Insets can be controlled with the supplied {@link WindowInsetsAnimationController} from * {@link #onReady} until either {@link #onFinished} or {@link #onCancelled}. * * <p> * Once the control over insets is finished or cancelled, it will not be regained until a new * request to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * <p> * The request to control insets can fail immediately. In that case {@link #onCancelled} will be * invoked without a preceding {@link #onReady}. * * @see WindowInsetsController#controlWindowInsetsAnimation */ */ public interface WindowInsetsAnimationControlListener { public interface WindowInsetsAnimationControlListener { /** * @hide */ default void onPrepare(int types) { } /** /** * Called when the animation is ready to be controlled. This may be delayed when the IME needs * Called when the animation is ready to be controlled. This may be delayed when the IME needs * to redraw because of an {@link EditorInfo} change, or when the window is starting up. * to redraw because of an {@link EditorInfo} change, or when the window is starting up. Loading @@ -41,14 +51,40 @@ public interface WindowInsetsAnimationControlListener { * {@link WindowInsetsController#controlWindowInsetsAnimation} in case the window * {@link WindowInsetsController#controlWindowInsetsAnimation} in case the window * wasn't able to gain the controls because it wasn't the IME target or not * 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. * currently the window that's controlling the system bars. * @see WindowInsetsAnimationController#isReady */ */ void onReady(@NonNull WindowInsetsAnimationController controller, @InsetsType int types); void onReady(@NonNull WindowInsetsAnimationController controller, @InsetsType int types); /** /** * Called when the window no longer has control over the requested types. If it loses control * Called when the request for control over the insets has * over one type, the whole control will be cancelled. If none of the requested types were * {@link WindowInsetsAnimationController#finish finished}. * available when requesting the control, the animation control will be cancelled immediately * * without {@link #onReady} being called. * Once this callback is invoked, the supplied {@link WindowInsetsAnimationController} * is no longer {@link WindowInsetsAnimationController#isReady() ready}. * * Control will not be regained until a new request * to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * @param controller the controller which has finished. * @see WindowInsetsAnimationController#isFinished */ void onFinished(@NonNull WindowInsetsAnimationController controller); /** * Called when the request for control over the insets has been cancelled, either * because the {@link android.os.CancellationSignal} associated with the * {@link WindowInsetsController#controlWindowInsetsAnimation request} 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 {@link WindowInsetsAnimationController} * is no longer {@link WindowInsetsAnimationController#isReady() ready}. * * Control will not be regained until a new request * to {@link WindowInsetsController#controlWindowInsetsAnimation} is made. * * @param controller the controller which has been cancelled, or null if the request * was cancelled before {@link #onReady} was invoked. * @see WindowInsetsAnimationController#isCancelled */ */ void onCancelled(); void onCancelled(@Nullable WindowInsetsAnimationController controller); } }