Merge "Insets Animations: Always dispatch onEnd when cancelled" into sc-dev am: e53e6f5c10
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15029085 Change-Id: I09617d3a91ea4e807b736d42adeaf8679b16ec50
This commit is contained in:
@@ -1265,7 +1265,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
}
|
}
|
||||||
stateChanged |= getSourceConsumer(types.valueAt(j)).notifyAnimationFinished();
|
stateChanged |= getSourceConsumer(types.valueAt(j)).notifyAnimationFinished();
|
||||||
}
|
}
|
||||||
if (invokeCallback && runningAnimation.startDispatched) {
|
if (invokeCallback) {
|
||||||
dispatchAnimationEnd(runningAnimation.runner.getAnimation());
|
dispatchAnimationEnd(runningAnimation.runner.getAnimation());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -110,6 +110,10 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
|
|||||||
@Override
|
@Override
|
||||||
public void dispatchWindowInsetsAnimationEnd(@NonNull WindowInsetsAnimation animation) {
|
public void dispatchWindowInsetsAnimationEnd(@NonNull WindowInsetsAnimation animation) {
|
||||||
if (DEBUG) Log.d(TAG, "windowInsetsAnimation ended");
|
if (DEBUG) Log.d(TAG, "windowInsetsAnimation ended");
|
||||||
|
if (mViewRoot.mView == null) {
|
||||||
|
// The view has already detached from window.
|
||||||
|
return;
|
||||||
|
}
|
||||||
mViewRoot.mView.dispatchWindowInsetsAnimationEnd(animation);
|
mViewRoot.mView.dispatchWindowInsetsAnimationEnd(animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,13 @@ public final class WindowInsetsAnimation {
|
|||||||
* finished, and then revert to the starting state of the animation in the first
|
* finished, and then revert to the starting state of the animation in the first
|
||||||
* {@link #onProgress} callback by using post-layout view properties like {@link View#setX}
|
* {@link #onProgress} callback by using post-layout view properties like {@link View#setX}
|
||||||
* and related methods.
|
* and related methods.
|
||||||
|
*
|
||||||
|
* <p>Note that the animation might be cancelled before {@link #onStart} is dispatched. On
|
||||||
|
* {@link android.os.Build.VERSION_CODES#S S} and later, {@link #onEnd} is immediately
|
||||||
|
* dispatched without an {@link #onStart} in that case.
|
||||||
|
* On {@link android.os.Build.VERSION_CODES#R R}, no callbacks are dispatched after
|
||||||
|
* {@code #onPrepare} for such an animation.
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: If the animation is application controlled by using
|
* Note: If the animation is application controlled by using
|
||||||
* {@link WindowInsetsController#controlWindowInsetsAnimation}, the end state of the
|
* {@link WindowInsetsController#controlWindowInsetsAnimation}, the end state of the
|
||||||
|
|||||||
Reference in New Issue
Block a user