summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/horizontal_divider.xml5
-rw-r--r--res/layout/popup_container.xml4
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java20
-rw-r--r--src/com/android/launcher3/shortcuts/ShortcutsItemView.java13
4 files changed, 15 insertions, 27 deletions
diff --git a/res/layout/horizontal_divider.xml b/res/layout/horizontal_divider.xml
deleted file mode 100644
index 167f8f5d8..000000000
--- a/res/layout/horizontal_divider.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<View xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/popup_item_divider_height"
- android:background="?attr/popupColorTertiary" /> \ No newline at end of file
diff --git a/res/layout/popup_container.xml b/res/layout/popup_container.xml
index e9cfe24ee..67db4a561 100644
--- a/res/layout/popup_container.xml
+++ b/res/layout/popup_container.xml
@@ -19,8 +19,8 @@
android:id="@+id/deep_shortcuts_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
android:clipToPadding="false"
android:clipChildren="false"
android:elevation="@dimen/deep_shortcuts_elevation"
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);
diff --git a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java
index f6fffe00b..b4fa04e42 100644
--- a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java
+++ b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java
@@ -24,7 +24,6 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
@@ -145,18 +144,8 @@ public class ShortcutsItemView extends PopupItemView implements View.OnLongClick
if (mSystemShortcutIcons == null) {
mSystemShortcutIcons = (LinearLayout) mLauncher.getLayoutInflater().inflate(
R.layout.system_shortcut_icons, mContent, false);
-
- View divider = LayoutInflater.from(getContext()).inflate(
- R.layout.horizontal_divider, this, false);
-
boolean iconsAreBelowShortcuts = mShortcutsLayout.getChildCount() > 0;
- if (iconsAreBelowShortcuts) {
- mContent.addView(divider);
- mContent.addView(mSystemShortcutIcons);
- } else {
- mContent.addView(divider, 0);
- mContent.addView(mSystemShortcutIcons, 0);
- }
+ mContent.addView(mSystemShortcutIcons, iconsAreBelowShortcuts ? -1 : 0);
}
mSystemShortcutIcons.addView(shortcutView, index);
} else {