Add "min size" facility to the Window class.
This allows us to have a new dialog theme that behaves like an alert dialog for both Dialog and Activity versions. Very useful with so many more things being displayed as dialogs on our nice large screen. Note I didn't change the existing dialog themes to have this behavior, since it will probably break things. Instead there is a new variation. And the DialogWhenLarge variations now use this for their dialog form, to fix many of the real new dialogs we have that need this behavior. Removed the public definition of the one alert dialog theme. None of the others have ever been public, this one shouldn't be. Added new .Panel versions of the Holo themes, like we already had for the original themes. Changed the alert dialog layout to no longer use WeightedLinearLayout, since the window now takes care of that. This allowed for the removal of the xlarge version of those layouts. Change-Id: I0c8372bde25eb9af47404a719b3f07230baf73bf
This commit is contained in:
508
api/current.xml
508
api/current.xml
File diff suppressed because it is too large
Load Diff
@@ -206,16 +206,6 @@ public class DialogFragment extends Fragment
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use {@link #show(FragmentManager, String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void show(Activity activity, String tag) {
|
||||
FragmentTransaction ft = activity.getFragmentManager().openTransaction();
|
||||
ft.add(this, tag);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the dialog, adding the fragment to the given FragmentManager. This
|
||||
* is a convenience for explicitly creating a transaction, adding the
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* //device/apps/common/res/layout/alert_dialog.xml
|
||||
**
|
||||
** Copyright 2006, 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.WeightedLinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parentPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="9dip"
|
||||
android:paddingBottom="3dip"
|
||||
android:paddingLeft="3dip"
|
||||
android:paddingRight="1dip"
|
||||
android:majorWeightMin="0.45"
|
||||
android:minorWeightMin="0.72">
|
||||
|
||||
<LinearLayout android:id="@+id/topPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="54dip"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout android:id="@+id/title_template"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="9dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip">
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:paddingTop="6dip"
|
||||
android:paddingRight="10dip"
|
||||
android:src="@drawable/ic_dialog_info" />
|
||||
<com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
|
||||
style="?android:attr/textAppearanceLarge"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<ImageView android:id="@+id/titleDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitXY"
|
||||
android:gravity="fill_horizontal"
|
||||
android:src="@android:drawable/divider_horizontal_dark" />
|
||||
<!-- If the client uses a customTitle, it will be added here. -->
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/contentPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<ScrollView android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dip"
|
||||
android:paddingBottom="12dip"
|
||||
android:paddingLeft="14dip"
|
||||
android:paddingRight="10dip">
|
||||
<TextView android:id="@+id/message"
|
||||
style="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dip" />
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout android:id="@+id/customPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<FrameLayout android:id="@+android:id/custom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:paddingBottom="5dip" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="54dip"
|
||||
android:orientation="vertical" >
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dip"
|
||||
android:paddingLeft="2dip"
|
||||
android:paddingRight="2dip"
|
||||
android:measureWithLargestChild="true">
|
||||
<LinearLayout android:id="@+id/leftSpacer"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" />
|
||||
<Button android:id="@+id/button1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="left"
|
||||
android:layout_weight="1"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:maxLines="2"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button android:id="@+id/button3"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:maxLines="2"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button android:id="@+id/button2"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="right"
|
||||
android:layout_weight="1"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:maxLines="2"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout android:id="@+id/rightSpacer"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.android.internal.widget.WeightedLinearLayout>
|
||||
@@ -1,162 +0,0 @@
|
||||
<?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.WeightedLinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parentPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:majorWeightMin="0.45"
|
||||
android:minorWeightMin="0.72">
|
||||
|
||||
<LinearLayout android:id="@+id/topPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="64dip"
|
||||
android:orientation="vertical">
|
||||
<ImageView android:id="@+id/titleDividerTop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dip"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitXY"
|
||||
android:gravity="fill_horizontal"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:src="@android:drawable/divider_strong_holo" />
|
||||
<LinearLayout android:id="@+id/title_template"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="8dip"
|
||||
android:layout_marginBottom="8dip"
|
||||
android:layout_marginLeft="32dip"
|
||||
android:layout_marginRight="32dip">
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="16dip"
|
||||
android:src="@null" />
|
||||
<com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
|
||||
style="?android:attr/textAppearanceMedium"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<ImageView android:id="@+id/titleDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dip"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitXY"
|
||||
android:gravity="fill_horizontal"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:src="@android:drawable/divider_strong_holo" />
|
||||
<!-- If the client uses a customTitle, it will be added here. -->
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/contentPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<ScrollView android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip"
|
||||
android:paddingTop="32dip"
|
||||
android:paddingBottom="32dip"
|
||||
android:clipToPadding="false">
|
||||
<TextView android:id="@+id/message"
|
||||
style="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip" />
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout android:id="@+id/customPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<FrameLayout android:id="@+android:id/custom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:paddingLeft="32dip"
|
||||
android:paddingRight="32dip" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="54dip"
|
||||
android:orientation="vertical"
|
||||
android:divider="?android:attr/dividerHorizontal"
|
||||
android:showDividers="beginning"
|
||||
android:dividerPadding="16dip">
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="2dip"
|
||||
android:paddingRight="2dip"
|
||||
android:measureWithLargestChild="true">
|
||||
<LinearLayout android:id="@+id/leftSpacer"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" />
|
||||
<Button android:id="@+id/button1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="left"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button android:id="@+id/button3"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button android:id="@+id/button2"
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="right"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout android:id="@+id/rightSpacer"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.android.internal.widget.WeightedLinearLayout>
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
-->
|
||||
|
||||
<com.android.internal.widget.WeightedLinearLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parentPanel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -27,9 +27,7 @@
|
||||
android:paddingTop="9dip"
|
||||
android:paddingBottom="3dip"
|
||||
android:paddingLeft="3dip"
|
||||
android:paddingRight="1dip"
|
||||
android:majorWeightMin="0.65"
|
||||
android:minorWeightMin="0.9">
|
||||
android:paddingRight="1dip">
|
||||
|
||||
<LinearLayout android:id="@+id/topPanel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -150,4 +148,4 @@
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.android.internal.widget.WeightedLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -17,14 +17,12 @@
|
||||
*/
|
||||
-->
|
||||
|
||||
<com.android.internal.widget.WeightedLinearLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parentPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:majorWeightMin="0.65"
|
||||
android:minorWeightMin="0.9">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:id="@+id/topPanel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -159,4 +157,4 @@
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.android.internal.widget.WeightedLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
22
core/res/res/values-large/dimens.xml
Normal file
22
core/res/res/values-large/dimens.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2011, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<item type="dimen" name="dialog_min_width_major">55%</item>
|
||||
<item type="dimen" name="dialog_min_width_minor">80%</item>
|
||||
</resources>
|
||||
@@ -18,17 +18,17 @@
|
||||
-->
|
||||
<resources>
|
||||
<style name="Theme.Holo.DialogWhenLarge"
|
||||
parent="@android:style/Theme.Holo.Dialog">
|
||||
parent="@android:style/Theme.Holo.Dialog.MinWidth">
|
||||
<item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
|
||||
</style>
|
||||
<style name="Theme.Holo.DialogWhenLarge.NoActionBar"
|
||||
parent="@android:style/Theme.Holo.Dialog.NoActionBar">
|
||||
parent="@android:style/Theme.Holo.Dialog.NoActionBar.MinWidth">
|
||||
<item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
|
||||
</style>
|
||||
<style name="Theme.Holo.Light.DialogWhenLarge"
|
||||
parent="@android:style/Theme.Holo.Light.Dialog">
|
||||
parent="@android:style/Theme.Holo.Light.Dialog.MinWidth">
|
||||
</style>
|
||||
<style name="Theme.Holo.Light.DialogWhenLarge.NoActionBar"
|
||||
parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
|
||||
parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar.MinWidth">
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -43,4 +43,7 @@
|
||||
<dimen name="app_icon_size">64dip</dimen>
|
||||
<!-- Minimum width of the search view text entry area. -->
|
||||
<dimen name="search_view_text_min_width">192dip</dimen>
|
||||
|
||||
<item type="dimen" name="dialog_min_width_major">45%</item>
|
||||
<item type="dimen" name="dialog_min_width_minor">72%</item>
|
||||
</resources>
|
||||
|
||||
@@ -1339,6 +1339,16 @@
|
||||
<attr name="windowActionModeOverlay" />
|
||||
<attr name="windowActionBarOverlay" />
|
||||
<attr name="windowEnableSplitTouch" />
|
||||
<!-- The minimum width the window is allowed to be, along the major
|
||||
axis of the screen. That is, when in landscape. Can be either
|
||||
an absolute dimension or a fraction of the screen size in that
|
||||
dimension. -->
|
||||
<attr name="windowMinWidthMajor" format="dimension|fraction" />
|
||||
<!-- The minimum width the window is allowed to be, along the minor
|
||||
axis of the screen. That is, when in portrait. Can be either
|
||||
an absolute dimension or a fraction of the screen size in that
|
||||
dimension. -->
|
||||
<attr name="windowMinWidthMinor" format="dimension|fraction" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- The set of attributes that describe a AlertDialog's theme. -->
|
||||
|
||||
@@ -58,4 +58,14 @@
|
||||
<dimen name="preference_screen_side_margin_negative">0dp</dimen>
|
||||
<!-- Preference widget area width (to the left of the text) -->
|
||||
<dimen name="preference_widget_width">56dp</dimen>
|
||||
|
||||
<!-- The platform's desired minimum size for a dialog's width when it
|
||||
is along the major axis (that is the screen is landscape). This may
|
||||
be either a fraction or a dimension. -->
|
||||
<item type="dimen" name="dialog_min_width_major">65%</item>
|
||||
|
||||
<!-- The platform's desired minimum size for a dialog's width when it
|
||||
is along the minor axis (that is the screen is portrait). This may
|
||||
be either a fraction or a dimension. -->
|
||||
<item type="dimen" name="dialog_min_width_minor">95%</item>
|
||||
</resources>
|
||||
|
||||
@@ -1422,6 +1422,8 @@
|
||||
<public type="attr" name="horizontalScrollViewStyle" />
|
||||
<public type="attr" name="layerType" />
|
||||
<public type="attr" name="alertDialogIcon" />
|
||||
<public type="attr" name="windowMinWidthMajor" />
|
||||
<public type="attr" name="windowMinWidthMinor" />
|
||||
|
||||
<!-- A simple fade-in animation. -->
|
||||
<public type="animator" name="fade_in" id="0x010b0000" />
|
||||
@@ -1473,6 +1475,9 @@
|
||||
<public type="id" name="selectTextMode" />
|
||||
<public type="id" name="up" />
|
||||
|
||||
<public type="dimen" name="dialog_min_width_major" />
|
||||
<public type="dimen" name="dialog_min_width_minor" />
|
||||
|
||||
<!-- Standard content view for a {@link android.app.ListFragment}.
|
||||
If you are implementing a subclass of ListFragment with your
|
||||
own customized content, you can include this layout in that
|
||||
@@ -1494,7 +1499,6 @@
|
||||
<public type="layout" name="simple_list_item_activated_2" />
|
||||
|
||||
<public type="style" name="Theme.WithActionBar" />
|
||||
<public type="style" name="Theme.Dialog.NoFrame" />
|
||||
<public type="style" name="Theme.NoTitleBar.OverlayActionModes" />
|
||||
|
||||
<public type="style" name="Theme.Holo" />
|
||||
@@ -1503,15 +1507,19 @@
|
||||
<public type="style" name="Theme.Holo.NoActionBar.Fullscreen" />
|
||||
<public type="style" name="Theme.Holo.Light" />
|
||||
<public type="style" name="Theme.Holo.Dialog" />
|
||||
<public type="style" name="Theme.Holo.Dialog.MinWidth" />
|
||||
<public type="style" name="Theme.Holo.Dialog.NoActionBar" />
|
||||
<public type="style" name="Theme.Holo.Dialog.NoActionBar.MinWidth" />
|
||||
<public type="style" name="Theme.Holo.Light.Dialog" />
|
||||
<public type="style" name="Theme.Holo.Light.Dialog.MinWidth" />
|
||||
<public type="style" name="Theme.Holo.Light.Dialog.NoActionBar" />
|
||||
<public type="style" name="Theme.Holo.Dialog.Alert" />
|
||||
<public type="style" name="Theme.Holo.Light.Dialog.Alert" />
|
||||
<public type="style" name="Theme.Holo.Light.Dialog.NoActionBar.MinWidth" />
|
||||
<public type="style" name="Theme.Holo.DialogWhenLarge" />
|
||||
<public type="style" name="Theme.Holo.DialogWhenLarge.NoActionBar" />
|
||||
<public type="style" name="Theme.Holo.Light.DialogWhenLarge" />
|
||||
<public type="style" name="Theme.Holo.Light.DialogWhenLarge.NoActionBar" />
|
||||
<public type="style" name="Theme.Holo.Panel" />
|
||||
<public type="style" name="Theme.Holo.Light.Panel" />
|
||||
<public type="style" name="Theme.Holo.Wallpaper" />
|
||||
<public type="style" name="Theme.Holo.Wallpaper.NoTitleBar" />
|
||||
|
||||
@@ -1635,6 +1643,7 @@
|
||||
<public type="style" name="Widget.CalendarView" />
|
||||
<public type="style" name="Widget.Holo.CalendarView" />
|
||||
<public type="style" name="Widget.Holo.Light.CalendarView" />
|
||||
|
||||
<public type="string" name="selectTextMode" />
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -563,6 +563,7 @@
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
@@ -578,6 +579,23 @@
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<!-- Default holo dark theme for panel windows. This removes all extraneous
|
||||
window decorations, so you basically have an empty rectangle in which
|
||||
to place your content. It makes the window floating, with a transparent
|
||||
background, and turns off dimming behind the window. -->
|
||||
<style name="Theme.Holo.Panel">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
@@ -593,6 +611,7 @@
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
@@ -1266,12 +1285,26 @@
|
||||
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Inverse</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Dialog that has a nice minumum width for
|
||||
a regular dialog. -->
|
||||
<style name="Theme.Holo.Dialog.MinWidth">
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Dialog that does not include a title bar. -->
|
||||
<style name="Theme.Holo.Dialog.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Dialog.NoActionVar that has a nice minumum width for
|
||||
a regular dialog. -->
|
||||
<style name="Theme.Holo.Dialog.NoActionBar.MinWidth">
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Dialog that does not include a frame (or background).
|
||||
The view hierarchy of the dialog is responsible for drawing all of
|
||||
its pixels. -->
|
||||
@@ -1294,6 +1327,8 @@
|
||||
<item name="windowBackground">@android:color/transparent</item>
|
||||
<item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo</item>
|
||||
<item name="windowContentOverlay">@null</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for a window that will be displayed either full-screen on
|
||||
@@ -1336,12 +1371,26 @@
|
||||
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Light.Inverse</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Light.Dialog that has a nice minumum width for
|
||||
a regular dialog. -->
|
||||
<style name="Theme.Holo.Light.Dialog.MinWidth">
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Light.Dialog that does not include a title bar. -->
|
||||
<style name="Theme.Holo.Light.Dialog.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<!-- Variation of Theme.Holo.Light.Dialog.NoActionBar that has a nice minumum width for
|
||||
a regular dialog. -->
|
||||
<style name="Theme.Holo.Light.Dialog.NoActionBar.MinWidth">
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for a window that will be displayed either full-screen on
|
||||
smaller screens (small, normal) or as a dialog on larger screens
|
||||
(large, xlarge). -->
|
||||
@@ -1364,6 +1413,8 @@
|
||||
<item name="windowBackground">@android:color/transparent</item>
|
||||
<item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo.Light</item>
|
||||
<item name="windowContentOverlay">@null</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
|
||||
</style>
|
||||
|
||||
<!-- Default holographic (dark) for windows that want to have the user's selected
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
package com.android.internal.policy.impl;
|
||||
|
||||
import static android.view.View.MeasureSpec.AT_MOST;
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.getMode;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
@@ -52,6 +55,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AndroidRuntimeException;
|
||||
import android.util.Config;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.EventLog;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -72,6 +76,7 @@ import android.view.ViewManager;
|
||||
import android.view.ViewStub;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.Animation;
|
||||
@@ -98,7 +103,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
* Simple callback used by the context menu and its submenus. The options
|
||||
* menu submenus do not use this (their behavior is more complex).
|
||||
*/
|
||||
DialogMenuCallback mContextMenuCallback = new DialogMenuCallback(FEATURE_CONTEXT_MENU);
|
||||
final DialogMenuCallback mContextMenuCallback = new DialogMenuCallback(FEATURE_CONTEXT_MENU);
|
||||
|
||||
final TypedValue mMinWidthMajor = new TypedValue();
|
||||
final TypedValue mMinWidthMinor = new TypedValue();
|
||||
|
||||
// This is the top-level view of the window, containing the window decor.
|
||||
private DecorView mDecor;
|
||||
@@ -1865,6 +1873,45 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
|
||||
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels;
|
||||
|
||||
final int widthMode = getMode(widthMeasureSpec);
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
int width = getMeasuredWidth();
|
||||
boolean measure = false;
|
||||
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, EXACTLY);
|
||||
|
||||
final TypedValue tv = isPortrait ? mMinWidthMinor : mMinWidthMajor;
|
||||
|
||||
if (widthMode == AT_MOST && tv.type != TypedValue.TYPE_NULL) {
|
||||
final int min;
|
||||
if (tv.type == TypedValue.TYPE_DIMENSION) {
|
||||
min = (int)tv.getDimension(metrics);
|
||||
} else if (tv.type == TypedValue.TYPE_FRACTION) {
|
||||
min = (int)tv.getFraction(metrics.widthPixels, metrics.widthPixels);
|
||||
} else {
|
||||
min = 0;
|
||||
}
|
||||
|
||||
if (width < min) {
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(min, EXACTLY);
|
||||
measure = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Support height?
|
||||
|
||||
if (measure) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
@@ -2274,6 +2321,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
setFlags(FLAG_SPLIT_TOUCH, FLAG_SPLIT_TOUCH&(~getForcedWindowFlags()));
|
||||
}
|
||||
|
||||
a.getValue(com.android.internal.R.styleable.Window_windowMinWidthMajor, mMinWidthMajor);
|
||||
a.getValue(com.android.internal.R.styleable.Window_windowMinWidthMinor, mMinWidthMinor);
|
||||
|
||||
if (getContext().getApplicationInfo().targetSdkVersion
|
||||
< android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);
|
||||
|
||||
Reference in New Issue
Block a user