summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup
diff options
context:
space:
mode:
authorTony <twickham@google.com>2017-07-05 12:32:16 -0700
committerTony <twickham@google.com>2017-07-05 12:32:16 -0700
commit45cdfa78d4f39db1d18514c4cab0e0e8442b5202 (patch)
tree4acfb54fe6c5b06fcc16a147d32648e77828211d /src/com/android/launcher3/popup
parentf593fb916e1da8f218b265ba4a752b31cf3b2fb6 (diff)
downloadandroid_packages_apps_Trebuchet-45cdfa78d4f39db1d18514c4cab0e0e8442b5202.tar.gz
android_packages_apps_Trebuchet-45cdfa78d4f39db1d18514c4cab0e0e8442b5202.tar.bz2
android_packages_apps_Trebuchet-45cdfa78d4f39db1d18514c4cab0e0e8442b5202.zip
Polish popup
- Remove divider between system shortcut header and shortcuts - Slightly reduce padding between popup and icon - Fix gravity to center in drag layer using x and y calculations since we use the y value to position the popup when removing notifications Change-Id: I1cb10ed953d11cc0924d8ee70881a434cb748317
Diffstat (limited to 'src/com/android/launcher3/popup')
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index c6ae0d290..3de9bad4c 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -44,7 +44,6 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
-import android.widget.FrameLayout;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BubbleTextView;
@@ -118,6 +117,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
private boolean mIsLeftAligned;
protected boolean mIsAboveIcon;
private View mArrow;
+ private int mGravity;
protected Animator mOpenCloseAnimator;
private boolean mDeferContainerRemoval;
@@ -490,9 +490,10 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
}
y -= insets.top;
- if (y < dragLayer.getTop() || y + height > dragLayer.getBottom()) {
+ mGravity = 0;
+ if (y + height > dragLayer.getBottom() - insets.bottom) {
// The container is opening off the screen, so just center it in the drag layer instead.
- ((FrameLayout.LayoutParams) getLayoutParams()).gravity = Gravity.CENTER_VERTICAL;
+ mGravity = Gravity.CENTER_VERTICAL;
// Put the container next to the icon, preferring the right side in ltr (left in rtl).
int rightSide = leftAlignedX + iconWidth - insets.left;
int leftSide = rightAlignedX - iconWidth - insets.left;
@@ -518,14 +519,17 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
if (x < dragLayer.getLeft() || x + width > dragLayer.getRight()) {
// If we are still off screen, center horizontally too.
- ((FrameLayout.LayoutParams) getLayoutParams()).gravity |= Gravity.CENTER_HORIZONTAL;
+ mGravity |= Gravity.CENTER_HORIZONTAL;
}
- int gravity = ((FrameLayout.LayoutParams) getLayoutParams()).gravity;
- if (!Gravity.isHorizontal(gravity)) {
+ if (Gravity.isHorizontal(mGravity)) {
+ setX(dragLayer.getWidth() / 2 - getMeasuredWidth() / 2);
+ } else {
setX(x);
}
- if (!Gravity.isVertical(gravity)) {
+ if (Gravity.isVertical(mGravity)) {
+ setY(dragLayer.getHeight() / 2 - getMeasuredHeight() / 2);
+ } else {
setY(y);
}
}
@@ -555,7 +559,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
}
View arrowView = new View(getContext());
- if (Gravity.isVertical(((FrameLayout.LayoutParams) getLayoutParams()).gravity)) {
+ if (Gravity.isVertical(mGravity)) {
// This is only true if there wasn't room for the container next to the icon,
// so we centered it instead. In that case we don't want to show the arrow.
arrowView.setVisibility(INVISIBLE);