diff options
| author | 2025-01-12 22:49:27 -0800 | |
|---|---|---|
| committer | 2025-01-12 22:49:27 -0800 | |
| commit | 9c77f4eb9ca9e5ee7ea7dd15459d081372c2a843 (patch) | |
| tree | d5d6acde1f7f7d607a235dd980fa36652f8955c7 | |
| parent | bbe32bb6788d6868fc1b79cf4245fffcbac44e40 (diff) | |
| parent | 77239f8b35130c0b9505b75643f2edd135bc86c4 (diff) | |
Merge "Don't use the user's fraction to decide the visibility of a leash" into main
| -rw-r--r-- | core/java/android/view/InsetsAnimationControlImpl.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java index 4fead2ad5246..6decd6d3a603 100644 --- a/core/java/android/view/InsetsAnimationControlImpl.java +++ b/core/java/android/view/InsetsAnimationControlImpl.java @@ -112,6 +112,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro private Insets mPendingInsets; private float mPendingFraction; private boolean mFinished; + private boolean mCancelling; private boolean mCancelled; private boolean mShownOnFinish; private float mCurrentAlpha = 1.0f; @@ -371,7 +372,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro mPendingInsets = mLayoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN ? mShownInsets : mHiddenInsets; mPendingAlpha = 1f; - mPendingFraction = 1f; + mCancelling = true; applyChangeInsets(null); mCancelled = true; mListener.onCancelled(mReadyDispatched ? this : null); @@ -488,15 +489,15 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro return; } - final boolean visible = mPendingFraction == 0 - // The first frame of ANIMATION_TYPE_SHOW should be invisible since it is - // animated from the hidden state. - ? mAnimationType != ANIMATION_TYPE_SHOW - : mPendingFraction < 1f || (mFinished - ? mShownOnFinish - // If the animation is cancelled, mFinished and mShownOnFinish are not set. + final boolean visible = mFinished + ? mShownOnFinish + : (mCancelling + // If the animation is being cancelled, mShownOnFinish is not valid. // Here uses mLayoutInsetsDuringAnimation to decide if it should be visible. - : mLayoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN); + ? mLayoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN + // The first frame of ANIMATION_TYPE_SHOW should be invisible since it is + // animated from the hidden state. + : (mAnimationType != ANIMATION_TYPE_SHOW || mPendingFraction != 0)); // TODO: Implement behavior when inset spans over multiple types for (int i = controls.size() - 1; i >= 0; i--) { |