From b25bb96223b206dd061dabc57963215f41021f6f Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Thu, 23 Sep 2021 09:13:20 +0800 Subject: [PATCH] Use the same animation setup in InsetsController for rounded corners Uses the same animation setup in InsetsController when animate rounded corners with insets changed. Also remove divider bar expanding animation to prevent it overlapping with rounded corners and stage outline. Bug: 200850654 Bug: 196272915 Test: atest WMShellUnitTests Test: manul check the behavior of rounded corners when expanding/collapsing task bar. Change-Id: I00449e1c25ca717305be7be9704f5805667adf45 --- .../wm/shell/common/split/DividerView.java | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java index f9ba97f8f9b1a..6ea806bd37993 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java @@ -25,6 +25,7 @@ import android.graphics.Rect; import android.util.AttributeSet; import android.util.Property; import android.view.GestureDetector; +import android.view.InsetsController; import android.view.InsetsSource; import android.view.InsetsState; import android.view.MotionEvent; @@ -34,7 +35,6 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.WindowManager; -import android.view.animation.Interpolator; import android.widget.FrameLayout; import androidx.annotation.NonNull; @@ -51,12 +51,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { public static final long TOUCH_ANIMATION_DURATION = 150; public static final long TOUCH_RELEASE_ANIMATION_DURATION = 200; - // TODO(b/191269755): use the value defined in InsetsController. - private static final Interpolator RESIZE_INTERPOLATOR = Interpolators.LINEAR; - - // TODO(b/191269755): use the value defined in InsetsController. - private static final int ANIMATION_DURATION_RESIZE = 300; - /** The task bar expanded height. Used to determine whether to insets divider bounds or not. */ private float mExpandedTaskBarHeight; @@ -142,8 +136,8 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { if (animate) { ObjectAnimator animator = ObjectAnimator.ofInt(this, DIVIDER_HEIGHT_PROPERTY, mDividerBounds.height(), mTempRect.height()); - animator.setInterpolator(RESIZE_INTERPOLATOR); - animator.setDuration(ANIMATION_DURATION_RESIZE); + animator.setInterpolator(InsetsController.RESIZE_INTERPOLATOR); + animator.setDuration(InsetsController.ANIMATION_DURATION_RESIZE); animator.start(); } else { DIVIDER_HEIGHT_PROPERTY.set(this, mTempRect.height()); @@ -226,16 +220,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { private void setTouching() { setSlippery(false); mHandle.setTouching(true, true); - if (isLandscape()) { - mBackground.animate().scaleX(1.4f); - } else { - mBackground.animate().scaleY(1.4f); - } - mBackground.animate() - .setInterpolator(Interpolators.TOUCH_RESPONSE) - .setDuration(TOUCH_ANIMATION_DURATION) - .translationZ(mTouchElevation) - .start(); // Lift handle as well so it doesn't get behind the background, even though it doesn't // cast shadow. mHandle.animate() @@ -248,13 +232,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { private void releaseTouching() { setSlippery(true); mHandle.setTouching(false, true); - mBackground.animate() - .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) - .setDuration(TOUCH_RELEASE_ANIMATION_DURATION) - .translationZ(0) - .scaleX(1f) - .scaleY(1f) - .start(); mHandle.animate() .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .setDuration(TOUCH_RELEASE_ANIMATION_DURATION)