From 8ee6d7c20e7767c2f61f8db9a99d01e0a05f3842 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Sun, 18 Sep 2011 14:59:28 -0700 Subject: [PATCH] Fix bug 5333962 - Problems with no action bar/overlay action mode Change the standalone action mode window for overlay mode to be of TYPE_APPLICATION. (This also fixes a bug where overflow menus would not work properly on these types of action mode bars.) Set exitFadeDuration on btn_cab_done_holo_* drawables. Remove no-window-focus override selector states for selectable item backgrounds to allow proper touch feedback on windows that do not have focus but that the user can interact with. Change-Id: Ib504866238708150d21e6183ff7b695869c05d3e --- core/java/android/widget/PopupWindow.java | 17 ++++++++++++++++- .../res/res/drawable/btn_cab_done_holo_dark.xml | 5 ++--- .../res/drawable/btn_cab_done_holo_light.xml | 5 ++--- .../res/drawable/item_background_holo_dark.xml | 2 -- .../res/drawable/item_background_holo_light.xml | 2 -- .../internal/policy/impl/PhoneWindow.java | 9 ++++++--- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 4d45c2fee094f..aac20c4434ad2 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -796,6 +796,21 @@ public class PopupWindow { * @param y the popup's y location offset */ public void showAtLocation(View parent, int gravity, int x, int y) { + showAtLocation(parent.getWindowToken(), gravity, x, y); + } + + /** + * Display the content view in a popup window at the specified location. + * + * @param token Window token to use for creating the new window + * @param gravity the gravity which controls the placement of the popup window + * @param x the popup's x location offset + * @param y the popup's y location offset + * + * @hide Internal use only. Applications should use + * {@link #showAtLocation(View, int, int, int)} instead. + */ + public void showAtLocation(IBinder token, int gravity, int x, int y) { if (isShowing() || mContentView == null) { return; } @@ -805,7 +820,7 @@ public class PopupWindow { mIsShowing = true; mIsDropdown = false; - WindowManager.LayoutParams p = createPopupLayout(parent.getWindowToken()); + WindowManager.LayoutParams p = createPopupLayout(token); p.windowAnimations = computeAnimationResource(); preparePopup(p); diff --git a/core/res/res/drawable/btn_cab_done_holo_dark.xml b/core/res/res/drawable/btn_cab_done_holo_dark.xml index 2cdb60509239d..65d3496a550d9 100644 --- a/core/res/res/drawable/btn_cab_done_holo_dark.xml +++ b/core/res/res/drawable/btn_cab_done_holo_dark.xml @@ -14,9 +14,8 @@ limitations under the License. --> - - + - - + - - diff --git a/core/res/res/drawable/item_background_holo_light.xml b/core/res/res/drawable/item_background_holo_light.xml index c616d86a1d3a6..ee3f4d8981544 100644 --- a/core/res/res/drawable/item_background_holo_light.xml +++ b/core/res/res/drawable/item_background_holo_light.xml @@ -17,8 +17,6 @@ - - diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 903b405218af5..1b7271db843b0 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2135,7 +2135,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { com.android.internal.R.attr.actionModePopupWindowStyle); mActionModePopup.setLayoutInScreenEnabled(true); mActionModePopup.setLayoutInsetDecor(true); - mActionModePopup.setClippingEnabled(false); + mActionModePopup.setWindowLayoutType( + WindowManager.LayoutParams.TYPE_APPLICATION); mActionModePopup.setContentView(mActionModeView); mActionModePopup.setWidth(MATCH_PARENT); @@ -2144,10 +2145,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { com.android.internal.R.attr.actionBarSize, heightValue, true); final int height = TypedValue.complexToDimensionPixelSize(heightValue.data, mContext.getResources().getDisplayMetrics()); - mActionModePopup.setHeight(height); + mActionModeView.setContentHeight(height); + mActionModePopup.setHeight(WRAP_CONTENT); mShowActionModePopup = new Runnable() { public void run() { - mActionModePopup.showAtLocation(PhoneWindow.DecorView.this, + mActionModePopup.showAtLocation( + mActionModeView.getApplicationWindowToken(), Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0); } };