diff options
author | Adam Powell <adamp@google.com> | 2011-07-25 10:57:42 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-25 10:57:42 -0700 |
commit | 5bd36eee8698553941bffdc795aa8f2cc66b6338 (patch) | |
tree | 64cab2772e4ee2178fe631dd92c916b3824bc382 /core | |
parent | 5518dd92d38edd5902482841413722aa654cc2e7 (diff) | |
parent | 0bd1d0a15294345bf88b20df28466907f982cec7 (diff) | |
download | frameworks_base-5bd36eee8698553941bffdc795aa8f2cc66b6338.zip frameworks_base-5bd36eee8698553941bffdc795aa8f2cc66b6338.tar.gz frameworks_base-5bd36eee8698553941bffdc795aa8f2cc66b6338.tar.bz2 |
Merge "Fix bug 5060033 - No text-editing toolbar when in a dialog"
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/View.java | 30 | ||||
-rw-r--r-- | core/java/android/widget/PopupWindow.java | 21 |
2 files changed, 51 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index c68b01c..dbb19e4 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4280,6 +4280,36 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } /** + * Set whether or not this view should account for system screen decorations + * such as the status bar and inset its content. This allows this view to be + * positioned in absolute screen coordinates and remain visible to the user. + * + * <p>This should only be used by top-level window decor views. + * + * @param fitSystemWindows true to inset content for system screen decorations, false for + * default behavior. + * + * @attr ref android.R.styleable#View_fitsSystemWindows + */ + public void setFitsSystemWindows(boolean fitSystemWindows) { + setFlags(fitSystemWindows ? FITS_SYSTEM_WINDOWS : 0, FITS_SYSTEM_WINDOWS); + } + + /** + * Check for the FITS_SYSTEM_WINDOWS flag. If this method returns true, this view + * will account for system screen decorations such as the status bar and inset its + * content. This allows the view to be positioned in absolute screen coordinates + * and remain visible to the user. + * + * @return true if this view will adjust its content bounds for system screen decorations. + * + * @attr ref android.R.styleable#View_fitsSystemWindows + */ + public boolean fitsSystemWindows() { + return (mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS; + } + + /** * Returns the visibility status for this view. * * @return One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}. diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 563fc26..36927ca 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -91,6 +91,7 @@ public class PopupWindow { private boolean mLayoutInScreen; private boolean mClipToScreen; private boolean mAllowScrollingAnchorParent = true; + private boolean mLayoutInsetDecor = false; private OnTouchListener mTouchInterceptor; @@ -658,6 +659,22 @@ public class PopupWindow { } /** + * Allows the popup window to force the flag + * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}, overriding default behavior. + * This will cause the popup to inset its content to account for system windows overlaying + * the screen, such as the status bar. + * + * <p>This will often be combined with {@link #setLayoutInScreenEnabled(boolean)}. + * + * @param enabled true if the popup's views should inset content to account for system windows, + * the way that decor views behave for full-screen windows. + * @hide + */ + public void setLayoutInsetDecor(boolean enabled) { + mLayoutInsetDecor = enabled; + } + + /** * Set the layout type for this window. Should be one of the TYPE constants defined in * {@link WindowManager.LayoutParams}. * @@ -942,6 +959,7 @@ public class PopupWindow { if (mContext != null) { p.packageName = mContext.getPackageName(); } + mPopupView.setFitsSystemWindows(mLayoutInsetDecor); mWindowManager.addView(mPopupView, p); } @@ -1012,6 +1030,9 @@ public class PopupWindow { if (mLayoutInScreen) { curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; } + if (mLayoutInsetDecor) { + curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; + } return curFlags; } |