summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2017-07-19 21:23:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-07-19 21:23:13 +0000
commitf567ee8f42cab072f10002302d85e99083122481 (patch)
treeb0328298b5f0e2776b89a3c51b08aa3c55185a8b /src
parent4dd5a5d19dd74c10694a04a28077efedb16b9bd1 (diff)
parentfebdbfcafb9bc99094fdc40169802048a3e68228 (diff)
downloadandroid_packages_apps_Trebuchet-f567ee8f42cab072f10002302d85e99083122481.tar.gz
android_packages_apps_Trebuchet-f567ee8f42cab072f10002302d85e99083122481.tar.bz2
android_packages_apps_Trebuchet-f567ee8f42cab072f10002302d85e99083122481.zip
Merge changes from topic 'am-47bc3657-4ec5-48ea-a081-c94faa8bfc8c' into ub-launcher3-dorval-polish2
* changes: PopupContainerWithArrow should align correctly in RTL mode Test: see attached screenshot in the bug am: 435a35dec3 PopupContainerWithArrow should align correctly in RTL mode Test: see attached screenshot in the bug
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 3de9bad4c..f5f7ddb31 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -399,6 +399,24 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
openAnim.start();
}
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ DragLayer dragLayer = mLauncher.getDragLayer();
+ if (getTranslationX() + l < 0 ||
+ getTranslationX() + l + getMeasuredWidth() > dragLayer.getWidth()) {
+ // If we are still off screen, center horizontally too.
+ mGravity |= Gravity.CENTER_HORIZONTAL;
+ }
+
+ if (Gravity.isHorizontal(mGravity)) {
+ setX(dragLayer.getWidth() / 2 - getMeasuredWidth() / 2);
+ }
+ if (Gravity.isVertical(mGravity)) {
+ setY(dragLayer.getHeight() / 2 - getMeasuredHeight() / 2);
+ }
+ }
+
/**
* Returns the point at which the center of the arrow merges with the first popup item.
*/
@@ -517,21 +535,8 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
mIsAboveIcon = true;
}
- if (x < dragLayer.getLeft() || x + width > dragLayer.getRight()) {
- // If we are still off screen, center horizontally too.
- mGravity |= Gravity.CENTER_HORIZONTAL;
- }
-
- if (Gravity.isHorizontal(mGravity)) {
- setX(dragLayer.getWidth() / 2 - getMeasuredWidth() / 2);
- } else {
- setX(x);
- }
- if (Gravity.isVertical(mGravity)) {
- setY(dragLayer.getHeight() / 2 - getMeasuredHeight() / 2);
- } else {
- setY(y);
- }
+ setX(x);
+ setY(y);
}
private boolean isAlignedWithStart() {