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

Commit a7287f4d authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 2927837 - PopupWindows don't account for xlarge status bar height

Add framework dimension resource screen_margin_bottom. This describes
the bottom margin formed by permanent screen decorations. In xlarge
configs this is equal to the height of the permanent system bar.

PopupWindows now size and position themselves with respect to
screen_margin_bottom.

Change-Id: I8960059adcf09605abf26c228bf877f5632fd11e
parent cdff2f24
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@

package android.widget;

import java.lang.ref.WeakReference;
import com.android.internal.R;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.graphics.Rect;
@@ -31,13 +32,13 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.View.OnTouchListener;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import android.view.WindowManager;

import com.android.internal.R;
import java.lang.ref.WeakReference;

/**
 * <p>A popup window that can be used to display an arbitrary view. The popup
@@ -1032,7 +1033,9 @@ public class PopupWindow {
        
        int bottomEdge = displayFrame.bottom;
        if (ignoreBottomDecorations) {
            bottomEdge = anchor.getContext().getResources().getDisplayMetrics().heightPixels;
            Resources res = anchor.getContext().getResources();
            bottomEdge = res.getDisplayMetrics().heightPixels -
                    (int) res.getDimension(com.android.internal.R.dimen.screen_margin_bottom);
        }
        final int distanceToBottom = bottomEdge - (anchorPos[1] + anchor.getHeight()) - yOffset;
        final int distanceToTop = anchorPos[1] - displayFrame.top + yOffset;
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
    <!-- Height of the status bar -->
    <dimen name="status_bar_icon_size">50dip</dimen>
    <!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
    <!-- Margin for permanent screen decorations at the bottom. -->
    <dimen name="screen_margin_bottom">50dip</dimen>
    
    <!-- Default height of a key in the password keyboard for alpha -->
    <dimen name="password_keyboard_key_height_alpha">0.35in</dimen>
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
    <dimen name="status_bar_icon_size">25dip</dimen>
    <!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
    <dimen name="status_bar_edge_ignore">5dp</dimen>
    <!-- Margin for permanent screen decorations at the bottom. -->
    <dimen name="screen_margin_bottom">0dip</dimen>
    <!-- Size of the fastscroll hint letter -->
    <dimen name="fastscroll_overlay_size">104dp</dimen>
    <!-- Width of the fastscroll thumb -->