Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08516061 authored by Robert Carr's avatar Robert Carr
Browse files

PopupWindow: Gravity fixes.

First we restore the M semantics with respect
to DISPLAY_CLIP_VERTICAL, which we only applied
for drop downs, and omitted in the case of
showAtLocation. Further, we fix an error where
user specified gravity from showAtLocation is
erased when calling update() by storing the
gravity and including it in computeGravity().

Bug: 30445010
Bug: 30965176
Change-Id: I28a081e1237a8b41f2444717e0db21ef4181507b
parent b19915be
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -193,6 +193,8 @@ public class PopupWindow {

    private int mAnimationStyle = ANIMATION_STYLE_DEFAULT;

    private int mGravity = Gravity.NO_GRAVITY;

    private static final int[] ABOVE_ANCHOR_STATE_SET = new int[] {
        com.android.internal.R.attr.state_above_anchor
    };
@@ -1141,15 +1143,11 @@ public class PopupWindow {

        mIsShowing = true;
        mIsDropdown = false;
        mGravity = gravity;

        final WindowManager.LayoutParams p = createPopupLayoutParams(token);
        preparePopup(p);

        // Only override the default if some gravity was specified.
        if (gravity != Gravity.NO_GRAVITY) {
            p.gravity = gravity;
        }

        p.x = x;
        p.y = y;

@@ -1394,8 +1392,8 @@ public class PopupWindow {
    }

    private int computeGravity() {
        int gravity = Gravity.START | Gravity.TOP;
        if (mClipToScreen || mClippingEnabled) {
        int gravity = mGravity == Gravity.NO_GRAVITY ?  Gravity.START | Gravity.TOP : mGravity;
        if (mIsDropdown && (mClipToScreen || mClippingEnabled)) {
            gravity |= Gravity.DISPLAY_CLIP_VERTICAL;
        }
        return gravity;