Merge "Polish popup" into ub-launcher3-dorval-polish

am: df5e2c1a74

Change-Id: Id2c843327c1764edbb2bc22c0b0278ecc6ac4188
This commit is contained in:
Tony Wickham 2017-07-05 22:25:13 +00:00 committed by android-build-merger
commit 4f16c9ccf5
4 changed files with 15 additions and 27 deletions

View File

@ -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" />

View File

@ -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"

View File

@ -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);

View File

@ -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 {