diff options
| -rw-r--r-- | core/java/android/widget/FastScroller.java | 2 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/AlertController.java | 14 | ||||
| -rw-r--r-- | core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png | bin | 9201 -> 7891 bytes | |||
| -rw-r--r-- | core/res/res/drawable-hdpi/dialog_full_holo_light.9.png | bin | 8827 -> 6865 bytes | |||
| -rw-r--r-- | core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png | bin | 5278 -> 4557 bytes | |||
| -rw-r--r-- | core/res/res/drawable-mdpi/dialog_full_holo_light.9.png | bin | 4995 -> 4032 bytes | |||
| -rw-r--r-- | core/res/res/layout-xlarge/alert_dialog_holo.xml | 13 | ||||
| -rw-r--r-- | core/res/res/layout/alert_dialog_holo.xml | 13 | ||||
| -rw-r--r-- | core/res/res/layout/dialog_custom_title_holo.xml | 43 | ||||
| -rw-r--r-- | core/res/res/layout/dialog_title_holo.xml | 50 | ||||
| -rw-r--r-- | core/res/res/layout/dialog_title_icons_holo.xml | 69 | ||||
| -rwxr-xr-x | core/res/res/values/attrs.xml | 6 | ||||
| -rw-r--r-- | core/res/res/values/styles.xml | 6 | ||||
| -rw-r--r-- | core/res/res/values/themes.xml | 9 | ||||
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 15 |
15 files changed, 222 insertions, 18 deletions
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index c06fe64538fa..d4ef044c6a18 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -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); diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java index e38432071c67..a139d31faed3 100644 --- a/core/java/com/android/internal/app/AlertController.java +++ b/core/java/com/android/internal/app/AlertController.java @@ -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); diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png Binary files differindex f0b204179a56..3b9e0cfd2090 100644 --- a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png +++ b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png Binary files differindex 5b93be7098ee..0665b08feba7 100644 --- a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png +++ b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png Binary files differindex a71af8d45429..bd5f9e0d281f 100644 --- a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png +++ b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png Binary files differindex 4017bf71cc83..45e97120dc13 100644 --- a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png +++ b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png diff --git a/core/res/res/layout-xlarge/alert_dialog_holo.xml b/core/res/res/layout-xlarge/alert_dialog_holo.xml index 2ae8db774d9e..2ebe7cd5af58 100644 --- a/core/res/res/layout-xlarge/alert_dialog_holo.xml +++ b/core/res/res/layout-xlarge/alert_dialog_holo.xml @@ -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" diff --git a/core/res/res/layout/alert_dialog_holo.xml b/core/res/res/layout/alert_dialog_holo.xml index 07a2853cba78..187504ec539d 100644 --- a/core/res/res/layout/alert_dialog_holo.xml +++ b/core/res/res/layout/alert_dialog_holo.xml @@ -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" diff --git a/core/res/res/layout/dialog_custom_title_holo.xml b/core/res/res/layout/dialog_custom_title_holo.xml new file mode 100644 index 000000000000..854873f02e7e --- /dev/null +++ b/core/res/res/layout/dialog_custom_title_holo.xml @@ -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> diff --git a/core/res/res/layout/dialog_title_holo.xml b/core/res/res/layout/dialog_title_holo.xml new file mode 100644 index 000000000000..534dd8dac96f --- /dev/null +++ b/core/res/res/layout/dialog_title_holo.xml @@ -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> diff --git a/core/res/res/layout/dialog_title_icons_holo.xml b/core/res/res/layout/dialog_title_icons_holo.xml new file mode 100644 index 000000000000..a3cd3afa5575 --- /dev/null +++ b/core/res/res/layout/dialog_title_icons_holo.xml @@ -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> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index b8b9e6c2754f..fb269a69a9b7 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -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 --> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 96e60f29f191..086e4869c588 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -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> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index ed8b20d7e6f6..94a58f0785ce 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -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> diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 38eed506d193..6232afd21b5d 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -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; |