Merge "PopupWindow: Use DISPLAY_CLIP_VERTICAL/HORIZONTAL." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8afc1f70f0
@@ -1393,6 +1393,14 @@ public class PopupWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int computeGravity() {
|
||||||
|
int gravity = Gravity.START | Gravity.TOP;
|
||||||
|
if (mClipToScreen || mClippingEnabled) {
|
||||||
|
gravity |= Gravity.DISPLAY_CLIP_VERTICAL | Gravity.DISPLAY_CLIP_HORIZONTAL;
|
||||||
|
}
|
||||||
|
return gravity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Generate the layout parameters for the popup window.</p>
|
* <p>Generate the layout parameters for the popup window.</p>
|
||||||
*
|
*
|
||||||
@@ -1407,7 +1415,7 @@ public class PopupWindow {
|
|||||||
// screen. The view is then positioned to the appropriate location by
|
// screen. The view is then positioned to the appropriate location by
|
||||||
// setting the x and y offsets to match the anchor's bottom-left
|
// setting the x and y offsets to match the anchor's bottom-left
|
||||||
// corner.
|
// corner.
|
||||||
p.gravity = Gravity.START | Gravity.TOP;
|
p.gravity = computeGravity();
|
||||||
p.flags = computeFlags(p.flags);
|
p.flags = computeFlags(p.flags);
|
||||||
p.type = mWindowLayoutType;
|
p.type = mWindowLayoutType;
|
||||||
p.token = token;
|
p.token = token;
|
||||||
@@ -1958,6 +1966,12 @@ public class PopupWindow {
|
|||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int newGravity = computeGravity();
|
||||||
|
if (newGravity != p.gravity) {
|
||||||
|
p.gravity = newGravity;
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
setLayoutDirectionFromAnchor();
|
setLayoutDirectionFromAnchor();
|
||||||
mWindowManager.updateViewLayout(mDecorView, p);
|
mWindowManager.updateViewLayout(mDecorView, p);
|
||||||
@@ -2064,6 +2078,12 @@ public class PopupWindow {
|
|||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int newGravity = computeGravity();
|
||||||
|
if (newGravity != p.gravity) {
|
||||||
|
p.gravity = newGravity;
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
|
||||||
int newAccessibilityIdOfAnchor =
|
int newAccessibilityIdOfAnchor =
|
||||||
(mAnchor != null) ? mAnchor.get().getAccessibilityViewId() : -1;
|
(mAnchor != null) ? mAnchor.get().getAccessibilityViewId() : -1;
|
||||||
if (newAccessibilityIdOfAnchor != p.accessibilityIdOfAnchor) {
|
if (newAccessibilityIdOfAnchor != p.accessibilityIdOfAnchor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user