Let action modes overlay window content
Change-Id: Ic0512c3e6338e1de15facec0a6650f9da9808a24
This commit is contained in:
@@ -16619,6 +16619,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Theme_NoTitleBar_OverlayActionModes"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973973"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Theme_Panel"
|
||||
type="int"
|
||||
transient="false"
|
||||
|
||||
22
core/res/res/layout/action_mode_bar.xml
Normal file
22
core/res/res/layout/action_mode_bar.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2010, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
@@ -26,11 +26,11 @@ This is the basic layout for a screen, with all of its features enabled.
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<!-- Popout bar for action modes -->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- Title bar -->
|
||||
<RelativeLayout android:id="@android:id/title_container"
|
||||
|
||||
@@ -22,11 +22,11 @@ This is an custom layout for a screen.
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
<!-- Popout bar for action modes -->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<FrameLayout android:id="@android:id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -27,11 +27,11 @@ This is the basic layout for a screen, with all of its features enabled.
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<!-- Popout bar for action modes -->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RelativeLayout android:id="@android:id/title_container"
|
||||
style="?android:attr/windowTitleBackgroundStyle"
|
||||
|
||||
@@ -24,11 +24,11 @@ enabled.
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<FrameLayout
|
||||
android:id="@android:id/content"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -23,11 +23,11 @@ enabled.
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
<!-- Popout bar for action modes -->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/windowTitleSize"
|
||||
|
||||
@@ -24,11 +24,11 @@ This is the basic layout for a screen, with all of its features enabled.
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Popout bar for action modes -->
|
||||
<com.android.internal.widget.ActionBarContextView
|
||||
android:id="@+id/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
<ViewStub android:id="@+id/action_mode_bar_stub"
|
||||
android:inflatedId="@+id/action_mode_bar"
|
||||
android:layout="@layout/action_mode_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<RelativeLayout android:id="@android:id/title_container"
|
||||
style="?android:attr/windowTitleBackgroundStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1325,6 +1325,7 @@
|
||||
<public type="style" name="Widget.Spinner.DropDown" />
|
||||
<public type="style" name="Widget.ActionButton" />
|
||||
<public type="style" name="Theme.Dialog.NoFrame" />
|
||||
<public type="style" name="Theme.NoTitleBar.OverlayActionModes" />
|
||||
|
||||
<!-- Standard content view for a {@link android.app.ListFragment}.
|
||||
If you are implementing a subclass of ListFragment with your
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
<item name="windowActionBarStyle">@android:style/ActionBar</item>
|
||||
|
||||
<!-- Dialog attributes -->
|
||||
@@ -544,8 +545,14 @@
|
||||
<item name="android:textColor">@android:color/secondary_text_nofocus</item>
|
||||
</style>
|
||||
|
||||
<!-- Default theme with an Action Bar. -->
|
||||
<style name="Theme.WithActionBar">
|
||||
<item name="android:windowActionBar">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- No title bar, but Action Mode bars will overlay application content
|
||||
instead of pushing it down to make room. -->
|
||||
<style name="Theme.NoTitleBar.OverlayActionModes">
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -71,6 +71,7 @@ import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewManager;
|
||||
import android.view.ViewStub;
|
||||
import android.view.VolumePanel;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@@ -1949,8 +1950,16 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
mActionMode = mode;
|
||||
} else {
|
||||
if (mActionModeView == null) {
|
||||
mActionModeView = (ActionBarContextView) findViewById(
|
||||
com.android.internal.R.id.action_mode_bar);
|
||||
if (hasFeature(FEATURE_ACTION_MODE_OVERLAY)) {
|
||||
mActionModeView = new ActionBarContextView(mContext);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
MATCH_PARENT, WRAP_CONTENT);
|
||||
addView(mActionModeView, params);
|
||||
} else {
|
||||
ViewStub stub = (ViewStub) findViewById(
|
||||
com.android.internal.R.id.action_mode_bar_stub);
|
||||
mActionModeView = (ActionBarContextView) stub.inflate();
|
||||
}
|
||||
}
|
||||
|
||||
if (mActionModeView != null) {
|
||||
|
||||
Reference in New Issue
Block a user