summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-04-11 14:42:17 -0700
committerTony <twickham@google.com>2017-04-14 13:32:12 -0700
commit8266115eb1509ca6d6a4b8b3e7933aac77b1b9df (patch)
treed0a7632e45f20c735deb70e8bf7fa03f95ca67dd /src/com/android/launcher3/popup
parent46b3a135280e6a72b6c178f7a6fd57cb056b1e3b (diff)
downloadandroid_packages_apps_Trebuchet-8266115eb1509ca6d6a4b8b3e7933aac77b1b9df.tar.gz
android_packages_apps_Trebuchet-8266115eb1509ca6d6a4b8b3e7933aac77b1b9df.tar.bz2
android_packages_apps_Trebuchet-8266115eb1509ca6d6a4b8b3e7933aac77b1b9df.zip
Fix popup item animation pivot
Now it is based on the arrow center instead of height / 2 (this used to be the same when all items were separate) Change-Id: I76c04344400c6d306e8404c1e93765adfbd0fe23
Diffstat (limited to 'src/com/android/launcher3/popup')
-rw-r--r--src/com/android/launcher3/popup/PopupItemView.java15
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 0853c13d3..a18f650c1 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);
}
}