diff options
author | Adam Powell <adamp@google.com> | 2010-08-17 21:17:04 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-08-17 21:17:04 -0700 |
commit | a7287f4d199b5d86e01d1de9d9a9db7e3221b02d (patch) | |
tree | 54a25d805197d988d06f729e60d6ff986a4ac720 | |
parent | cdff2f242425874a4a9758e9ce2fb0e4f3f1afa4 (diff) | |
download | frameworks_base-a7287f4d199b5d86e01d1de9d9a9db7e3221b02d.zip frameworks_base-a7287f4d199b5d86e01d1de9d9a9db7e3221b02d.tar.gz frameworks_base-a7287f4d199b5d86e01d1de9d9a9db7e3221b02d.tar.bz2 |
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
-rw-r--r-- | core/java/android/widget/PopupWindow.java | 13 | ||||
-rw-r--r-- | core/res/res/values-xlarge/dimens.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/dimens.xml | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index b562942..4a3e2a9 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -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; diff --git a/core/res/res/values-xlarge/dimens.xml b/core/res/res/values-xlarge/dimens.xml index bc1ae58..1a16da7 100644 --- a/core/res/res/values-xlarge/dimens.xml +++ b/core/res/res/values-xlarge/dimens.xml @@ -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> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 3b38bd5..d3aa2d4 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -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 --> |