diff options
author | Tony Wickham <twickham@google.com> | 2017-04-17 18:49:06 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-17 18:49:06 +0000 |
commit | c1cac5f5541403bcad61b03cfa31458aeca40554 (patch) | |
tree | a93d40dabe1b8eda01a77d894ce290cf74990ffb /src | |
parent | 65a585946be38119dce842a44e0632b5acc74e6e (diff) | |
parent | 251dabfd765cd4422ff3fd2d6a7f70834413831c (diff) | |
download | android_packages_apps_Trebuchet-c1cac5f5541403bcad61b03cfa31458aeca40554.tar.gz android_packages_apps_Trebuchet-c1cac5f5541403bcad61b03cfa31458aeca40554.tar.bz2 android_packages_apps_Trebuchet-c1cac5f5541403bcad61b03cfa31458aeca40554.zip |
Merge "Fix popup item animation pivot" into ub-launcher3-dorval
am: 251dabfd76
Change-Id: I6be4feabc9781504b85351eca04517b8d6c31dbf
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/popup/PopupItemView.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/com/android/launcher3/popup/PopupItemView.java b/src/com/android/launcher3/popup/PopupItemView.java index 73112986a..5ead971be 100644 --- a/src/com/android/launcher3/popup/PopupItemView.java +++ b/src/com/android/launcher3/popup/PopupItemView.java @@ -120,8 +120,9 @@ public abstract class PopupItemView extends FrameLayout */ public Animator createOpenAnimation(boolean isContainerAboveIcon, boolean pivotLeft) { Point center = getIconCenter(); + int arrowCenter = getResources().getDimensionPixelSize(R.dimen.popup_arrow_horizontal_center); ValueAnimator openAnimator = new ZoomRevealOutlineProvider(center.x, center.y, - mPillRect, this, mIconView, isContainerAboveIcon, pivotLeft) + mPillRect, this, mIconView, isContainerAboveIcon, pivotLeft, arrowCenter) .createRevealAnimator(this, false); mOpenAnimationProgress = 0f; openAnimator.addUpdateListener(this); @@ -143,8 +144,9 @@ public abstract class PopupItemView extends FrameLayout public Animator createCloseAnimation(boolean isContainerAboveIcon, boolean pivotLeft, long duration) { Point center = getIconCenter(); + int arrowCenter = getResources().getDimensionPixelSize(R.dimen.popup_arrow_horizontal_center); ValueAnimator closeAnimator = new ZoomRevealOutlineProvider(center.x, center.y, - mPillRect, this, mIconView, isContainerAboveIcon, pivotLeft) + mPillRect, this, mIconView, isContainerAboveIcon, pivotLeft, arrowCenter) .createRevealAnimator(this, true); // Scale down the duration and interpolator according to the progress // that the open animation was at when the close started. @@ -188,9 +190,10 @@ public abstract class PopupItemView extends FrameLayout private final boolean mPivotLeft; private final float mTranslateX; + private final float mArrowCenter; public ZoomRevealOutlineProvider(int x, int y, Rect pillRect, PopupItemView translateView, - View zoomView, boolean isContainerAboveIcon, boolean pivotLeft) { + View zoomView, boolean isContainerAboveIcon, boolean pivotLeft, float arrowCenter) { super(x, y, pillRect, translateView.getBackgroundRadius()); mTranslateView = translateView; mZoomView = zoomView; @@ -199,7 +202,8 @@ public abstract class PopupItemView extends FrameLayout mTranslateYMultiplier = isContainerAboveIcon ? 0.5f : -0.5f; mPivotLeft = pivotLeft; - mTranslateX = pivotLeft ? pillRect.height() / 2 : pillRect.right - pillRect.height() / 2; + mTranslateX = pivotLeft ? arrowCenter : pillRect.right - arrowCenter; + mArrowCenter = arrowCenter; } @Override @@ -214,7 +218,8 @@ public abstract class PopupItemView extends FrameLayout float height = mOutline.height(); mTranslateView.setTranslationY(mTranslateYMultiplier * (mFullHeight - height)); - float pivotX = mPivotLeft ? (mOutline.left + height / 2) : (mOutline.right - height / 2); + float offsetX = Math.min(mOutline.width(), mArrowCenter); + float pivotX = mPivotLeft ? (mOutline.left + offsetX) : (mOutline.right - offsetX); mTranslateView.setTranslationX(mTranslateX - pivotX); } } |