Merge "Fix bug 5333962 - Problems with no action bar/overlay action mode"
This commit is contained in:
@ -796,6 +796,21 @@ public class PopupWindow {
|
|||||||
* @param y the popup's y location offset
|
* @param y the popup's y location offset
|
||||||
*/
|
*/
|
||||||
public void showAtLocation(View parent, int gravity, int x, int y) {
|
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) {
|
if (isShowing() || mContentView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -805,7 +820,7 @@ public class PopupWindow {
|
|||||||
mIsShowing = true;
|
mIsShowing = true;
|
||||||
mIsDropdown = false;
|
mIsDropdown = false;
|
||||||
|
|
||||||
WindowManager.LayoutParams p = createPopupLayout(parent.getWindowToken());
|
WindowManager.LayoutParams p = createPopupLayout(token);
|
||||||
p.windowAnimations = computeAnimationResource();
|
p.windowAnimations = computeAnimationResource();
|
||||||
|
|
||||||
preparePopup(p);
|
preparePopup(p);
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<item android:state_window_focused="false" android:state_enabled="true"
|
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
||||||
android:drawable="@drawable/btn_cab_done_default_holo_dark" />
|
|
||||||
<item android:state_pressed="true"
|
<item android:state_pressed="true"
|
||||||
android:drawable="@drawable/btn_cab_done_pressed_holo_dark" />
|
android:drawable="@drawable/btn_cab_done_pressed_holo_dark" />
|
||||||
<item android:state_focused="true" android:state_enabled="true"
|
<item android:state_focused="true" android:state_enabled="true"
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<item android:state_window_focused="false" android:state_enabled="true"
|
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
||||||
android:drawable="@drawable/btn_cab_done_default_holo_light" />
|
|
||||||
<item android:state_pressed="true"
|
<item android:state_pressed="true"
|
||||||
android:drawable="@drawable/btn_cab_done_pressed_holo_light" />
|
android:drawable="@drawable/btn_cab_done_pressed_holo_light" />
|
||||||
<item android:state_focused="true" android:state_enabled="true"
|
<item android:state_focused="true" android:state_enabled="true"
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
||||||
|
|
||||||
<item android:state_window_focused="false" android:drawable="@color/transparent" />
|
|
||||||
|
|
||||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
|
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_dark" />
|
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_dark" />
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
||||||
|
|
||||||
<item android:state_window_focused="false" android:drawable="@color/transparent" />
|
|
||||||
|
|
||||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
|
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" />
|
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" />
|
||||||
|
@ -2135,7 +2135,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
com.android.internal.R.attr.actionModePopupWindowStyle);
|
com.android.internal.R.attr.actionModePopupWindowStyle);
|
||||||
mActionModePopup.setLayoutInScreenEnabled(true);
|
mActionModePopup.setLayoutInScreenEnabled(true);
|
||||||
mActionModePopup.setLayoutInsetDecor(true);
|
mActionModePopup.setLayoutInsetDecor(true);
|
||||||
mActionModePopup.setClippingEnabled(false);
|
mActionModePopup.setWindowLayoutType(
|
||||||
|
WindowManager.LayoutParams.TYPE_APPLICATION);
|
||||||
mActionModePopup.setContentView(mActionModeView);
|
mActionModePopup.setContentView(mActionModeView);
|
||||||
mActionModePopup.setWidth(MATCH_PARENT);
|
mActionModePopup.setWidth(MATCH_PARENT);
|
||||||
|
|
||||||
@ -2144,10 +2145,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
com.android.internal.R.attr.actionBarSize, heightValue, true);
|
com.android.internal.R.attr.actionBarSize, heightValue, true);
|
||||||
final int height = TypedValue.complexToDimensionPixelSize(heightValue.data,
|
final int height = TypedValue.complexToDimensionPixelSize(heightValue.data,
|
||||||
mContext.getResources().getDisplayMetrics());
|
mContext.getResources().getDisplayMetrics());
|
||||||
mActionModePopup.setHeight(height);
|
mActionModeView.setContentHeight(height);
|
||||||
|
mActionModePopup.setHeight(WRAP_CONTENT);
|
||||||
mShowActionModePopup = new Runnable() {
|
mShowActionModePopup = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
mActionModePopup.showAtLocation(PhoneWindow.DecorView.this,
|
mActionModePopup.showAtLocation(
|
||||||
|
mActionModeView.getApplicationWindowToken(),
|
||||||
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
|
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user