From ef20912f0c59d76eb198ac73e4ee816b998740af Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 27 Apr 2022 19:04:28 +0000 Subject: [PATCH] [RSearches] Set the status correctly after the panel animation is done We do not need to check the height when set the panel's status, since onHeightAnimationFinished is only called when the animation is finished, not canceled. (cherry picked from commit 40afecdccee29d38620ab7715605d132f9832656) Bug: 1316167 Change-Id: I124a151f44bb4f2a591a343fb9549a70f1e622fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3593964 Reviewed-by: Donn Denman Commit-Queue: Gang Wu Cr-Original-Commit-Position: refs/heads/main@{#994335} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3606139 Auto-Submit: Gang Wu Bot-Commit: Rubber Stamper Cr-Commit-Position: refs/branch-heads/5005@{#205} Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738} --- .../bottombar/OverlayPanelAnimation.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java index 5367aec0317663..a5c495a8569dfc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelAnimation.java @@ -382,17 +382,13 @@ public void onEnd(Animator animation) { /** * Called when layout-specific actions are needed after the animation finishes. + * This method should only be called when the animation ends normally and not when it is + * canceled. */ protected void onHeightAnimationFinished() { - // If animating to a particular PanelState, and after completing - // resizing the Panel to its desired state, then the Panel's state - // should be updated. This method also is called when an animation - // is cancelled (which can happen by a subsequent gesture while - // an animation is happening). That's why the actual height should - // be checked. - if (mAnimatingState != null && mAnimatingState != PanelState.UNDEFINED - && MathUtils.areFloatsEqual( - getHeight(), getPanelHeightFromState(mAnimatingState))) { + // If animating to a particular PanelState, and after completing resizing the Panel to its + // desired state, then the Panel's state should be updated. + if (mAnimatingState != null && mAnimatingState != PanelState.UNDEFINED) { setPanelState(mAnimatingState, mAnimatingStateReason); }