Skip to content

Commit d413eb3

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug 5333962 - Problems with no action bar/overlay action mode"
2 parents ce801c4 + 8ee6d7c commit d413eb3

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

core/java/android/widget/PopupWindow.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,21 @@ public boolean isShowing() {
796796
* @param y the popup's y location offset
797797
*/
798798
public void showAtLocation(View parent, int gravity, int x, int y) {
799+
showAtLocation(parent.getWindowToken(), gravity, x, y);
800+
}
801+
802+
/**
803+
* Display the content view in a popup window at the specified location.
804+
*
805+
* @param token Window token to use for creating the new window
806+
* @param gravity the gravity which controls the placement of the popup window
807+
* @param x the popup's x location offset
808+
* @param y the popup's y location offset
809+
*
810+
* @hide Internal use only. Applications should use
811+
* {@link #showAtLocation(View, int, int, int)} instead.
812+
*/
813+
public void showAtLocation(IBinder token, int gravity, int x, int y) {
799814
if (isShowing() || mContentView == null) {
800815
return;
801816
}
@@ -805,7 +820,7 @@ public void showAtLocation(View parent, int gravity, int x, int y) {
805820
mIsShowing = true;
806821
mIsDropdown = false;
807822

808-
WindowManager.LayoutParams p = createPopupLayout(parent.getWindowToken());
823+
WindowManager.LayoutParams p = createPopupLayout(token);
809824
p.windowAnimations = computeAnimationResource();
810825

811826
preparePopup(p);

core/res/res/drawable/btn_cab_done_holo_dark.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
limitations under the License.
1515
-->
1616

17-
<selector xmlns:android="http://schemas.android.com/apk/res/android">
18-
<item android:state_window_focused="false" android:state_enabled="true"
19-
android:drawable="@drawable/btn_cab_done_default_holo_dark" />
17+
<selector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
2019
<item android:state_pressed="true"
2120
android:drawable="@drawable/btn_cab_done_pressed_holo_dark" />
2221
<item android:state_focused="true" android:state_enabled="true"

core/res/res/drawable/btn_cab_done_holo_light.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
limitations under the License.
1515
-->
1616

17-
<selector xmlns:android="http://schemas.android.com/apk/res/android">
18-
<item android:state_window_focused="false" android:state_enabled="true"
19-
android:drawable="@drawable/btn_cab_done_default_holo_light" />
17+
<selector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
2019
<item android:state_pressed="true"
2120
android:drawable="@drawable/btn_cab_done_pressed_holo_light" />
2221
<item android:state_focused="true" android:state_enabled="true"

core/res/res/drawable/item_background_holo_dark.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
<selector xmlns:android="http://schemas.android.com/apk/res/android"
1818
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
1919

20-
<item android:state_window_focused="false" android:drawable="@color/transparent" />
21-
2220
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
2321
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
2422
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_dark" />

core/res/res/drawable/item_background_holo_light.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
<selector xmlns:android="http://schemas.android.com/apk/res/android"
1818
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
1919

20-
<item android:state_window_focused="false" android:drawable="@color/transparent" />
21-
2220
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
2321
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
2422
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" />

policy/src/com/android/internal/policy/impl/PhoneWindow.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,8 @@ public ActionMode startActionMode(ActionMode.Callback callback) {
21352135
com.android.internal.R.attr.actionModePopupWindowStyle);
21362136
mActionModePopup.setLayoutInScreenEnabled(true);
21372137
mActionModePopup.setLayoutInsetDecor(true);
2138-
mActionModePopup.setClippingEnabled(false);
2138+
mActionModePopup.setWindowLayoutType(
2139+
WindowManager.LayoutParams.TYPE_APPLICATION);
21392140
mActionModePopup.setContentView(mActionModeView);
21402141
mActionModePopup.setWidth(MATCH_PARENT);
21412142

@@ -2144,10 +2145,12 @@ public ActionMode startActionMode(ActionMode.Callback callback) {
21442145
com.android.internal.R.attr.actionBarSize, heightValue, true);
21452146
final int height = TypedValue.complexToDimensionPixelSize(heightValue.data,
21462147
mContext.getResources().getDisplayMetrics());
2147-
mActionModePopup.setHeight(height);
2148+
mActionModeView.setContentHeight(height);
2149+
mActionModePopup.setHeight(WRAP_CONTENT);
21482150
mShowActionModePopup = new Runnable() {
21492151
public void run() {
2150-
mActionModePopup.showAtLocation(PhoneWindow.DecorView.this,
2152+
mActionModePopup.showAtLocation(
2153+
mActionModeView.getApplicationWindowToken(),
21512154
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
21522155
}
21532156
};

0 commit comments

Comments
 (0)