Merge "Fix bug 3338079 - Dialog styled activity decor" into honeycomb
@ -606,7 +606,7 @@ class FastScroller {
|
||||
final int positionsInSection = nextSectionPos - sectionPos;
|
||||
|
||||
final View child = mList.getChildAt(0);
|
||||
final float incrementalPos = firstVisibleItem +
|
||||
final float incrementalPos = child == null ? 0 : firstVisibleItem +
|
||||
(float) (mList.getPaddingTop() - child.getTop()) / child.getHeight();
|
||||
final float posWithinSection = (incrementalPos - sectionPos) / positionsInSection;
|
||||
int result = (int) ((section + posWithinSection) / sectionCount * trackHeight);
|
||||
|
@ -412,9 +412,17 @@ public class AlertController {
|
||||
/* Only display the divider if we have a title and a
|
||||
* custom view or a message.
|
||||
*/
|
||||
if (hasTitle && ((mMessage != null) || (mView != null))) {
|
||||
View divider = mWindow.findViewById(R.id.titleDivider);
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
if (hasTitle) {
|
||||
View divider = null;
|
||||
if (mMessage != null || mView != null || mListView != null) {
|
||||
divider = mWindow.findViewById(R.id.titleDivider);
|
||||
} else {
|
||||
divider = mWindow.findViewById(R.id.titleDividerTop);
|
||||
}
|
||||
|
||||
if (divider != null) {
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel);
|
||||
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 3.9 KiB |
@ -23,10 +23,6 @@
|
||||
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">
|
||||
|
||||
@ -35,6 +31,15 @@
|
||||
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"
|
||||
|
@ -23,10 +23,6 @@
|
||||
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.65"
|
||||
android:minorWeightMin="0.9">
|
||||
|
||||
@ -35,6 +31,15 @@
|
||||
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"
|
||||
|
43
core/res/res/layout/dialog_custom_title_holo.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is an custom layout for a dialog.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
<FrameLayout android:id="@android:id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dip"
|
||||
android:layout_weight="0"
|
||||
style="?android:attr/windowTitleBackgroundStyle">
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:foreground="?android:attr/windowContentOverlay">
|
||||
<FrameLayout android:id="@android:id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="6dip"
|
||||
android:paddingBottom="10dip"
|
||||
android:paddingLeft="10dip"
|
||||
android:paddingRight="10dip" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
50
core/res/res/layout/dialog_title_holo.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
This is an optimized layout for a screen, with the minimum set of features
|
||||
enabled.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="60dip"
|
||||
android:paddingLeft="32dip"
|
||||
android:paddingRight="32dip"
|
||||
android:gravity="center_vertical|left" />
|
||||
<ImageView android:id="@+id/titleDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dip"
|
||||
android:scaleType="fitXY"
|
||||
android:gravity="fill_horizontal"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:src="@android:drawable/divider_strong_holo" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:foreground="?android:attr/windowContentOverlay">
|
||||
<FrameLayout android:id="@android:id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
69
core/res/res/layout/dialog_title_icons_holo.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is an optimized layout for a screen, with the minimum set of features
|
||||
enabled.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="60dip"
|
||||
android:paddingLeft="32dip"
|
||||
android:paddingRight="32dip">
|
||||
<ImageView android:id="@+id/left_icon"
|
||||
android:layout_width="32dip"
|
||||
android:layout_height="32dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginRight="8dip" />
|
||||
<TextView android:id="@android:id/title"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0" />
|
||||
<ImageView android:id="@+id/right_icon"
|
||||
android:layout_width="32dip"
|
||||
android:layout_height="32dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginLeft="8dip" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView android:id="@+id/titleDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dip"
|
||||
android:scaleType="fitXY"
|
||||
android:gravity="fill_horizontal"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:src="@android:drawable/divider_strong_holo" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:foreground="?android:attr/windowContentOverlay">
|
||||
<FrameLayout android:id="@android:id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
@ -634,6 +634,12 @@
|
||||
|
||||
<!-- Theme to use for dialogs spawned from this theme. -->
|
||||
<attr name="dialogTheme" format="reference" />
|
||||
<!-- Window decor layout to use in dialog mode with icons -->
|
||||
<attr name="dialogTitleIconsDecorLayout" format="reference" />
|
||||
<!-- Window decor layout to use in dialog mode with custom titles -->
|
||||
<attr name="dialogCustomTitleDecorLayout" format="reference" />
|
||||
<!-- Window decor layout to use in dialog mode with title only -->
|
||||
<attr name="dialogTitleDecorLayout" format="reference" />
|
||||
<!-- Theme to use for alert dialogs spawned from this theme. -->
|
||||
<attr name="alertDialogTheme" format="reference" />
|
||||
<!-- Icon drawable to use for alerts -->
|
||||
|
@ -1512,8 +1512,8 @@
|
||||
<style name="Widget.Holo.ProgressBar.Horizontal" parent="Widget.ProgressBar.Horizontal">
|
||||
<item name="android:progressDrawable">@android:drawable/progress_horizontal_holo_dark</item>
|
||||
<item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal_holo</item>
|
||||
<item name="android:minHeight">24dip</item>
|
||||
<item name="android:maxHeight">24dip</item>
|
||||
<item name="android:minHeight">16dip</item>
|
||||
<item name="android:maxHeight">16dip</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.ProgressBar.Small" parent="Widget.ProgressBar.Small">
|
||||
@ -1728,7 +1728,7 @@
|
||||
|
||||
<style name="Widget.Holo.Light.Button" parent="Widget.Button">
|
||||
<item name="android:background">@android:drawable/btn_default_holo_light</item>
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
|
||||
<item name="android:textColor">@android:color/primary_text_holo_light</item>
|
||||
<item name="android:minHeight">48dip</item>
|
||||
<item name="android:paddingLeft">32dip</item>
|
||||
|
@ -142,6 +142,9 @@
|
||||
<!-- Dialog attributes -->
|
||||
<item name="alertDialogStyle">@android:style/AlertDialog</item>
|
||||
<item name="dialogTheme">@android:style/Theme.Dialog</item>
|
||||
<item name="dialogTitleIconsDecorLayout">@layout/dialog_title_icons</item>
|
||||
<item name="dialogCustomTitleDecorLayout">@layout/dialog_custom_title</item>
|
||||
<item name="dialogTitleDecorLayout">@layout/dialog_title</item>
|
||||
<item name="alertDialogTheme">@android:style/Theme.Dialog.Alert</item>
|
||||
<item name="alertDialogCenterButtons">true</item>
|
||||
<item name="alertDialogIcon">@android:drawable/ic_dialog_alert</item>
|
||||
@ -807,6 +810,9 @@
|
||||
<!-- Dialog attributes -->
|
||||
<item name="alertDialogStyle">@android:style/AlertDialog.Holo</item>
|
||||
<item name="dialogTheme">@android:style/Theme.Holo.Dialog</item>
|
||||
<item name="dialogTitleIconsDecorLayout">@layout/dialog_title_icons_holo</item>
|
||||
<item name="dialogCustomTitleDecorLayout">@layout/dialog_custom_title_holo</item>
|
||||
<item name="dialogTitleDecorLayout">@layout/dialog_title_holo</item>
|
||||
<item name="alertDialogTheme">@android:style/Theme.Holo.Dialog.Alert</item>
|
||||
<item name="alertDialogCenterButtons">false</item>
|
||||
<item name="alertDialogIcon">@android:drawable/ic_dialog_alert_holo_dark</item>
|
||||
@ -1065,6 +1071,9 @@
|
||||
<!-- Dialog attributes -->
|
||||
<item name="alertDialogStyle">@android:style/AlertDialog.Holo.Light</item>
|
||||
<item name="dialogTheme">@android:style/Theme.Holo.Light.Dialog</item>
|
||||
<item name="dialogTitleIconsDecorLayout">@layout/dialog_title_icons_holo</item>
|
||||
<item name="dialogCustomTitleDecorLayout">@layout/dialog_custom_title_holo</item>
|
||||
<item name="dialogTitleDecorLayout">@layout/dialog_title_holo</item>
|
||||
<item name="alertDialogTheme">@android:style/Theme.Holo.Light.Dialog.Alert</item>
|
||||
<item name="alertDialogIcon">@android:drawable/ic_dialog_alert_holo_light</item>
|
||||
|
||||
|
@ -2329,7 +2329,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
// System.out.println("Features: 0x" + Integer.toHexString(features));
|
||||
if ((features & ((1 << FEATURE_LEFT_ICON) | (1 << FEATURE_RIGHT_ICON))) != 0) {
|
||||
if (mIsFloating) {
|
||||
layoutResource = com.android.internal.R.layout.dialog_title_icons;
|
||||
TypedValue res = new TypedValue();
|
||||
getContext().getTheme().resolveAttribute(
|
||||
com.android.internal.R.attr.dialogTitleIconsDecorLayout, res, true);
|
||||
layoutResource = res.resourceId;
|
||||
} else {
|
||||
layoutResource = com.android.internal.R.layout.screen_title_icons;
|
||||
}
|
||||
@ -2346,7 +2349,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
// Special case for a window with a custom title.
|
||||
// If the window is floating, we need a dialog layout
|
||||
if (mIsFloating) {
|
||||
layoutResource = com.android.internal.R.layout.dialog_custom_title;
|
||||
TypedValue res = new TypedValue();
|
||||
getContext().getTheme().resolveAttribute(
|
||||
com.android.internal.R.attr.dialogCustomTitleDecorLayout, res, true);
|
||||
layoutResource = res.resourceId;
|
||||
} else {
|
||||
layoutResource = com.android.internal.R.layout.screen_custom_title;
|
||||
}
|
||||
@ -2356,7 +2362,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
// If no other features and not embedded, only need a title.
|
||||
// If the window is floating, we need a dialog layout
|
||||
if (mIsFloating) {
|
||||
layoutResource = com.android.internal.R.layout.dialog_title;
|
||||
TypedValue res = new TypedValue();
|
||||
getContext().getTheme().resolveAttribute(
|
||||
com.android.internal.R.attr.dialogTitleDecorLayout, res, true);
|
||||
layoutResource = res.resourceId;
|
||||
} else if ((features & (1 << FEATURE_ACTION_BAR)) != 0) {
|
||||
if ((features & (1 << FEATURE_ACTION_BAR_OVERLAY)) != 0) {
|
||||
layoutResource = com.android.internal.R.layout.screen_action_bar_overlay;
|
||||
|