summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-07-25 10:57:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-25 10:57:42 -0700
commit5bd36eee8698553941bffdc795aa8f2cc66b6338 (patch)
tree64cab2772e4ee2178fe631dd92c916b3824bc382
parent5518dd92d38edd5902482841413722aa654cc2e7 (diff)
parent0bd1d0a15294345bf88b20df28466907f982cec7 (diff)
downloadframeworks_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"
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/view/View.java30
-rw-r--r--core/java/android/widget/PopupWindow.java21
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java3
4 files changed, 55 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt
index e0e7565..cb5efa3 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22232,6 +22232,7 @@ package android.view {
method public final android.view.View findViewWithTag(java.lang.Object);
method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence);
method protected boolean fitSystemWindows(android.graphics.Rect);
+ method public boolean fitsSystemWindows();
method public android.view.View focusSearch(int);
method public void forceLayout();
method public float getAlpha();
@@ -22473,6 +22474,7 @@ package android.view {
method public void setEnabled(boolean);
method public void setFadingEdgeLength(int);
method public void setFilterTouchesWhenObscured(boolean);
+ method public void setFitsSystemWindows(boolean);
method public void setFocusable(boolean);
method public void setFocusableInTouchMode(boolean);
method public void setHapticFeedbackEnabled(boolean);
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;
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e0debf7..bfc3cdd 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2040,13 +2040,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mActionModePopup = new PopupWindow(mContext, null,
com.android.internal.R.attr.actionModePopupWindowStyle);
mActionModePopup.setLayoutInScreenEnabled(true);
+ mActionModePopup.setLayoutInsetDecor(true);
mActionModePopup.setClippingEnabled(false);
mActionModePopup.setContentView(mActionModeView);
mActionModePopup.setWidth(MATCH_PARENT);
TypedValue heightValue = new TypedValue();
mContext.getTheme().resolveAttribute(
- com.android.internal.R.attr.actionBarSize, heightValue, false);
+ com.android.internal.R.attr.actionBarSize, heightValue, true);
final int height = TypedValue.complexToDimensionPixelSize(heightValue.data,
mContext.getResources().getDisplayMetrics());
mActionModePopup.setHeight(height);