diff options
-rw-r--r-- | core/java/android/app/AlertDialog.java | 20 | ||||
-rw-r--r-- | core/java/android/app/DatePickerDialog.java | 1 | ||||
-rw-r--r-- | core/java/android/app/TimePickerDialog.java | 1 | ||||
-rw-r--r-- | core/java/com/android/internal/app/AlertController.java | 27 | ||||
-rw-r--r-- | core/res/res/layout/alert_dialog_leanback.xml | 131 | ||||
-rw-r--r-- | core/res/res/layout/alert_dialog_leanback_button_panel_right.xml | 142 | ||||
-rw-r--r-- | core/res/res/layout/progress_dialog_leanback.xml | 48 | ||||
-rw-r--r-- | core/res/res/values-television/themes.xml | 23 | ||||
-rw-r--r-- | core/res/res/values-television/themes_device_defaults.xml | 19 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 1 | ||||
-rw-r--r-- | core/res/res/values/colors.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/dimens.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/styles_leanback.xml | 59 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
-rw-r--r-- | core/res/res/values/themes.xml | 28 | ||||
-rw-r--r-- | core/res/res/values/themes_leanback.xml | 47 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 13 |
17 files changed, 552 insertions, 16 deletions
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index ab148a9..4ce7835 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -92,6 +92,18 @@ public class AlertDialog extends Dialog implements DialogInterface { * the device's default alert theme with a light background. */ public static final int THEME_DEVICE_DEFAULT_LIGHT = 5; + + /** + * No layout hint. + * @hide + */ + public static final int LAYOUT_HINT_NONE = 0; + + /** + * Hint layout to the side. + * @hide + */ + public static final int LAYOUT_HINT_SIDE = 1; protected AlertDialog(Context context) { this(context, resolveDialogTheme(context, 0), true); @@ -208,6 +220,14 @@ public class AlertDialog extends Dialog implements DialogInterface { } /** + * Internal api to allow hinting for the best button panel layout. + * @hide + */ + void setButtonPanelLayoutHint(int layoutHint) { + mAlert.setButtonPanelLayoutHint(layoutHint); + } + + /** * Set a message to be sent when a button is pressed. * * @param whichButton Which button to set the message for, can be one of diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java index d168800..26c2c30 100644 --- a/core/java/android/app/DatePickerDialog.java +++ b/core/java/android/app/DatePickerDialog.java @@ -107,6 +107,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, (LayoutInflater) themeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.date_picker_dialog, null); setView(view); + setButtonPanelLayoutHint(LAYOUT_HINT_SIDE); mDatePicker = (DatePicker) view.findViewById(R.id.datePicker); mDatePicker.init(year, monthOfYear, dayOfMonth, this); updateTitle(year, monthOfYear, dayOfMonth); diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java index a85c61f..8cf8c25 100644 --- a/core/java/android/app/TimePickerDialog.java +++ b/core/java/android/app/TimePickerDialog.java @@ -110,6 +110,7 @@ public class TimePickerDialog extends AlertDialog (LayoutInflater) themeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.time_picker_dialog, null); setView(view); + setButtonPanelLayoutHint(LAYOUT_HINT_SIDE); mTimePicker = (TimePicker) view.findViewById(R.id.timePicker); // Initialize state diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java index b568121..664f9db 100644 --- a/core/java/com/android/internal/app/AlertController.java +++ b/core/java/com/android/internal/app/AlertController.java @@ -123,11 +123,14 @@ public class AlertController { private int mCheckedItem = -1; private int mAlertDialogLayout; + private int mButtonPanelSideLayout; private int mListLayout; private int mMultiChoiceItemLayout; private int mSingleChoiceItemLayout; private int mListItemLayout; + private int mButtonPanelLayoutHint = AlertDialog.LAYOUT_HINT_NONE; + private Handler mHandler; private final View.OnClickListener mButtonHandler = new View.OnClickListener() { @@ -199,6 +202,9 @@ public class AlertController { mAlertDialogLayout = a.getResourceId(com.android.internal.R.styleable.AlertDialog_layout, com.android.internal.R.layout.alert_dialog); + mButtonPanelSideLayout = a.getResourceId( + com.android.internal.R.styleable.AlertDialog_buttonPanelSideLayout, 0); + mListLayout = a.getResourceId( com.android.internal.R.styleable.AlertDialog_listLayout, com.android.internal.R.layout.select_dialog); @@ -240,10 +246,22 @@ public class AlertController { public void installContent() { /* We use a custom title so never request a window title */ mWindow.requestFeature(Window.FEATURE_NO_TITLE); - mWindow.setContentView(mAlertDialogLayout); + int contentView = selectContentView(); + mWindow.setContentView(contentView); setupView(); setupDecor(); } + + private int selectContentView() { + if (mButtonPanelSideLayout == 0) { + return mAlertDialogLayout; + } + if (mButtonPanelLayoutHint == AlertDialog.LAYOUT_HINT_SIDE) { + return mButtonPanelSideLayout; + } + // TODO: use layout hint side for long messages/lists + return mAlertDialogLayout; + } public void setTitle(CharSequence title) { mTitle = title; @@ -299,6 +317,13 @@ public class AlertController { } /** + * Sets a hint for the best button panel layout. + */ + public void setButtonPanelLayoutHint(int layoutHint) { + mButtonPanelLayoutHint = layoutHint; + } + + /** * Sets a click listener or a message to be sent when the button is clicked. * You only need to pass one of {@code listener} or {@code msg}. * diff --git a/core/res/res/layout/alert_dialog_leanback.xml b/core/res/res/layout/alert_dialog_leanback.xml new file mode 100644 index 0000000..8655aea --- /dev/null +++ b/core/res/res/layout/alert_dialog_leanback.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2014, 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. +*/ +--> + +<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:layout_marginLeft="@dimen/leanback_alert_dialog_horizontal_margin" + android:layout_marginRight="@dimen/leanback_alert_dialog_horizontal_margin" + android:layout_marginTop="@dimen/leanback_alert_dialog_vertical_margin" + android:layout_marginBottom="@dimen/leanback_alert_dialog_vertical_margin" + android:orientation="vertical"> + + <LinearLayout android:id="@+id/topPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + 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|start" + android:minHeight="@dimen/alert_dialog_title_height" + android:layout_marginStart="16dip" + android:layout_marginEnd="16dip"> + <ImageView android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingEnd="8dip" + android:src="@null" /> + <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" + style="?android:attr/windowTitleStyle" + android:singleLine="true" + android:ellipsize="end" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAlignment="viewStart" /> + </LinearLayout> + <!-- 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" + android:minHeight="64dp"> + <ScrollView android:id="@+id/scrollView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clipToPadding="false"> + <TextView android:id="@+id/message" + style="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="16dip" + android:paddingEnd="16dip" + android:paddingTop="8dip" + android:paddingBottom="8dip"/> + </ScrollView> + </LinearLayout> + + <FrameLayout android:id="@+id/customPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:minHeight="64dp"> + <FrameLayout android:id="@+android:id/custom" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </FrameLayout> + + <LinearLayout android:id="@+id/buttonPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:orientation="vertical"> + <LinearLayout + style="?android:attr/buttonBarStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layoutDirection="locale" + android:measureWithLargestChild="true"> + <Button android:id="@+id/button2" + android:layout_width="wrap_content" + android:layout_gravity="start" + android:layout_weight="1" + android:maxLines="2" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button3" + android:layout_width="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_weight="1" + android:maxLines="2" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button1" + android:layout_width="wrap_content" + android:layout_gravity="end" + android:layout_weight="1" + android:maxLines="2" + android:minHeight="@dimen/alert_dialog_button_bar_height" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:layout_height="wrap_content" /> + </LinearLayout> + </LinearLayout> +</LinearLayout> diff --git a/core/res/res/layout/alert_dialog_leanback_button_panel_right.xml b/core/res/res/layout/alert_dialog_leanback_button_panel_right.xml new file mode 100644 index 0000000..096b015 --- /dev/null +++ b/core/res/res/layout/alert_dialog_leanback_button_panel_right.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2014, 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. +*/ +--> + +<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:layout_marginLeft="@dimen/leanback_alert_dialog_horizontal_margin" + android:layout_marginRight="@dimen/leanback_alert_dialog_horizontal_margin" + android:layout_marginTop="@dimen/leanback_alert_dialog_vertical_margin" + android:layout_marginBottom="@dimen/leanback_alert_dialog_vertical_margin" + android:orientation="horizontal"> + + <LinearLayout + android:id="@+id/leftPanel" + android:layout_width="0dp" + android:layout_weight="0.66" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout android:id="@+id/topPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + 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|start" + android:minHeight="@dimen/alert_dialog_title_height" + android:layout_marginStart="16dip" + android:layout_marginEnd="16dip"> + <ImageView android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingEnd="8dip" + android:src="@null" /> + <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" + style="?android:attr/windowTitleStyle" + android:singleLine="true" + android:ellipsize="end" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAlignment="viewStart" /> + </LinearLayout> + <!-- 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:orientation="vertical" + android:minHeight="64dp"> + <ScrollView android:id="@+id/scrollView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clipToPadding="false"> + <TextView android:id="@+id/message" + style="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="16dip" + android:paddingEnd="16dip" + android:paddingTop="8dip" + android:paddingBottom="8dip"/> + </ScrollView> + </LinearLayout> + + <FrameLayout android:id="@+id/customPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:minHeight="64dp"> + <FrameLayout android:id="@+android:id/custom" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </FrameLayout> + </LinearLayout> + + <LinearLayout android:id="@+id/buttonPanel" + android:layout_width="0dp" + android:layout_weight="0.33" + android:layout_height="match_parent" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:paddingLeft="32dp" + android:paddingRight="32dp" + android:orientation="horizontal"> + <LinearLayout + style="?android:attr/buttonBarStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:orientation="vertical" + android:layoutDirection="locale" + android:measureWithLargestChild="true"> + <Button android:id="@+id/button1" + android:layout_width="match_parent" + android:gravity="center_vertical" + android:layout_weight="1" + android:maxLines="2" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button3" + android:layout_width="match_parent" + android:gravity="center_vertical" + android:layout_weight="1" + android:maxLines="2" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:minHeight="@dimen/alert_dialog_button_bar_height" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button2" + android:layout_width="match_parent" + android:gravity="center_vertical" + android:layout_weight="1" + android:maxLines="2" + android:minHeight="@dimen/alert_dialog_button_bar_height" + style="?android:attr/buttonBarButtonStyle" + android:textSize="14sp" + android:layout_height="wrap_content" /> + </LinearLayout> + </LinearLayout> +</LinearLayout> diff --git a/core/res/res/layout/progress_dialog_leanback.xml b/core/res/res/layout/progress_dialog_leanback.xml new file mode 100644 index 0000000..6bcad7a --- /dev/null +++ b/core/res/res/layout/progress_dialog_leanback.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2014, 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. +*/ +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <View + android:layout_width="match_parent" + android:layout_height="2dip" + android:background="@android:color/leanback_dark_gray" /> + <LinearLayout android:id="@+id/body" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:baselineAligned="false" + android:padding="16dip"> + + <ProgressBar android:id="@android:id/progress" + style="?android:attr/progressBarStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:max="10000" + android:layout_marginEnd="16dip" /> + + <TextView android:id="@+id/message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + </LinearLayout> +</LinearLayout> diff --git a/core/res/res/values-television/themes.xml b/core/res/res/values-television/themes.xml new file mode 100644 index 0000000..6e17cdd --- /dev/null +++ b/core/res/res/values-television/themes.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2014 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> + <style name="Theme.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" /> + <style name="Theme.Dialog.AppError" parent="Theme.Leanback.Dialog.AppError" /> + <style name="Theme.Holo.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" /> + <style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" /> + <style name="Theme.Quantum.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" /> + <style name="Theme.Quantum.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" /> +</resources> diff --git a/core/res/res/values-television/themes_device_defaults.xml b/core/res/res/values-television/themes_device_defaults.xml new file mode 100644 index 0000000..e01caa3 --- /dev/null +++ b/core/res/res/values-television/themes_device_defaults.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2014 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> + <style name="Theme.DeviceDefault.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" /> + <style name="Theme.DeviceDefault.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" /> +</resources> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index c3ad731..327f6cf 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1790,6 +1790,7 @@ <attr name="bottomMedium" format="reference|color" /> <attr name="centerMedium" format="reference|color" /> <attr name="layout" /> + <attr name="buttonPanelSideLayout" format="reference" /> <attr name="listLayout" format="reference" /> <attr name="multiChoiceItemLayout" format="reference" /> <attr name="singleChoiceItemLayout" format="reference" /> diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 7d3fb44..ad29505 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -120,6 +120,9 @@ <color name="micro_text_light">#434343</color> + <color name="leanback_dark_gray">#ff333333</color> + <color name="leanback_light_gray">#ff888888</color> + <drawable name="notification_template_icon_bg">#3333B5E5</drawable> <drawable name="notification_template_icon_low_bg">#0cffffff</drawable> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index bf92f9b..69b11cd 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -149,6 +149,10 @@ <dimen name="alert_dialog_title_height">64dip</dimen> <!-- Dialog button bar height --> <dimen name="alert_dialog_button_bar_height">48dip</dimen> + <!-- Leanback dialog vertical margin --> + <dimen name="leanback_alert_dialog_vertical_margin">27dip</dimen> + <!-- Leanback dialog horizontal margin --> + <dimen name="leanback_alert_dialog_horizontal_margin">54dip</dimen> <!-- Default height of an action bar. --> <dimen name="action_bar_default_height">48dip</dimen> diff --git a/core/res/res/values/styles_leanback.xml b/core/res/res/values/styles_leanback.xml new file mode 100644 index 0000000..a37da4e --- /dev/null +++ b/core/res/res/values/styles_leanback.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2014 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> + <style name="DialogWindowTitle.Leanback" parent="DialogWindowTitle.Holo"> + <item name="android:textAppearance">@style/TextAppearance.Leanback.DialogWindowTitle</item> + </style> + + <style name="TextAppearance.Leanback.DialogWindowTitle" parent="TextAppearance.Holo.DialogWindowTitle"> + <item name="android:fontFamily">sans-serif-condensed</item> + <item name="android:textColor">?attr/textColorPrimary</item> + </style> + + <style name="Leanback.ButtonBar" parent="Holo.ButtonBar"> + <item name="showDividers">none</item> + </style> + + <style name="AlertDialog.Leanback" parent="AlertDialog.Holo"> + <item name="layout">@android:layout/alert_dialog_leanback</item> + <item name="buttonPanelSideLayout">@android:layout/alert_dialog_leanback_button_panel_right</item> + <item name="progressLayout">@android:layout/progress_dialog_leanback</item> + <item name="fullDark">@android:color/background_dark</item> + <item name="topDark">@android:color/background_dark</item> + <item name="centerDark">@android:color/background_dark</item> + <item name="bottomDark">@android:color/background_dark</item> + <item name="fullBright">@android:color/background_dark</item> + <item name="topBright">@android:color/background_dark</item> + <item name="centerBright">@android:color/background_dark</item> + <item name="bottomBright">@android:color/background_dark</item> + <item name="bottomMedium">@android:color/background_dark</item> + <item name="centerMedium">@android:color/background_dark</item> + </style> + + <style name="AlertDialog.Leanback.Light"> + <item name="fullDark">@android:color/leanback_light_gray</item> + <item name="topDark">@android:color/leanback_light_gray</item> + <item name="centerDark">@android:color/leanback_light_gray</item> + <item name="bottomDark">@android:color/leanback_light_gray</item> + <item name="fullBright">@android:color/leanback_light_gray</item> + <item name="topBright">@android:color/leanback_light_gray</item> + <item name="centerBright">@android:color/leanback_light_gray</item> + <item name="bottomBright">@android:color/leanback_light_gray</item> + <item name="bottomMedium">@android:color/leanback_light_gray</item> + <item name="centerMedium">@android:color/leanback_light_gray</item> + </style> + +</resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 1057cc2..a14f241 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1630,6 +1630,7 @@ <java-symbol type="string" name="wifi_display_notification_disconnect" /> <java-symbol type="style" name="Theme.Dialog.AppError" /> <java-symbol type="style" name="Theme.Micro.Dialog.Alert" /> + <java-symbol type="style" name="Theme.Leanback.Dialog.Alert" /> <java-symbol type="style" name="Theme.Toast" /> <java-symbol type="xml" name="storage_list" /> <java-symbol type="bool" name="config_dreamsSupported" /> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 34ef508..1d9bbae 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -1811,12 +1811,7 @@ please see themes_device_defaults.xml. <item name="android:windowCloseOnTouchOutside">false</item> </style> - <!-- Holo theme for alert dialog windows, which is used by the - {@link android.app.AlertDialog} class. This is basically a dialog - but sets the background to empty so it can do two-tone backgrounds. - For applications targeting Honeycomb or newer, this is the default - AlertDialog theme. --> - <style name="Theme.Holo.Dialog.Alert"> + <style name="Theme.Holo.Dialog.BaseAlert"> <item name="windowBackground">@android:color/transparent</item> <item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo</item> <item name="windowContentOverlay">@null</item> @@ -1824,6 +1819,13 @@ please see themes_device_defaults.xml. <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item> </style> + <!-- Holo theme for alert dialog windows, which is used by the + {@link android.app.AlertDialog} class. This is basically a dialog + but sets the background to empty so it can do two-tone backgrounds. + For applications targeting Honeycomb or newer, this is the default + AlertDialog theme. --> + <style name="Theme.Holo.Dialog.Alert" parent="Theme.Holo.Dialog.BaseAlert"/> + <!-- Holo theme for the TimePicker dialog windows, which is used by the {@link android.app.TimePickerDialog} class. --> <style name="Theme.Holo.Dialog.TimePicker"> @@ -1934,12 +1936,7 @@ please see themes_device_defaults.xml. parent="@android:style/Theme.Holo.Light.NoActionBar"> </style> - <!-- Holo light theme for alert dialog windows, which is used by the - {@link android.app.AlertDialog} class. This is basically a dialog - but sets the background to empty so it can do two-tone backgrounds. - For applications targeting Honeycomb or newer, this is the default - AlertDialog theme. --> - <style name="Theme.Holo.Light.Dialog.Alert"> + <style name="Theme.Holo.Light.Dialog.BaseAlert"> <item name="windowBackground">@android:color/transparent</item> <item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo.Light</item> <item name="windowContentOverlay">@null</item> @@ -1947,6 +1944,13 @@ please see themes_device_defaults.xml. <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item> </style> + <!-- Holo light theme for alert dialog windows, which is used by the + {@link android.app.AlertDialog} class. This is basically a dialog + but sets the background to empty so it can do two-tone backgrounds. + For applications targeting Honeycomb or newer, this is the default + AlertDialog theme. --> + <style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Holo.Light.Dialog.BaseAlert"/> + <!-- Holo Light theme for the TimePicker dialog windows, which is used by the {@link android.app.TimePickerDialog} class. --> <style name="Theme.Holo.Light.Dialog.TimePicker"> diff --git a/core/res/res/values/themes_leanback.xml b/core/res/res/values/themes_leanback.xml new file mode 100644 index 0000000..eba8dec --- /dev/null +++ b/core/res/res/values/themes_leanback.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2014 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> + <style name="Theme.Leanback.Dialog.Alert" parent="Theme.Holo.Dialog.BaseAlert"> + <item name="windowTitleStyle">@style/DialogWindowTitle.Leanback</item> + <item name="alertDialogStyle">@style/AlertDialog.Leanback</item> + <item name="buttonBarStyle">@style/Leanback.ButtonBar</item> + <item name="listDividerAlertDialog">@null</item> + </style> + + <style name="Theme.Leanback.Light.Dialog.Alert" parent="Theme.Holo.Light.Dialog.BaseAlert"> + <item name="windowTitleStyle">@style/DialogWindowTitle.Leanback</item> + <item name="alertDialogStyle">@style/AlertDialog.Leanback.Light</item> + <item name="buttonBarStyle">@style/Leanback.ButtonBar</item> + <item name="listDividerAlertDialog">@null</item> + </style> + + <style name="Theme.Leanback.Light.Dialog" parent="Theme.Holo.Light.Dialog"> + <item name="windowTitleStyle">@style/DialogWindowTitle.Leanback</item> + </style> + + <style name="Theme.Leanback.Dialog" parent="Theme.Holo.Dialog"> + <item name="windowTitleStyle">@style/DialogWindowTitle.Leanback</item> + </style> + + <style name="Theme.Leanback.Dialog.AppError" parent="Theme.Leanback.Dialog"> + <item name="windowFrame">@null</item> + <item name="windowBackground">@color/transparent</item> + <item name="windowIsFloating">true</item> + <item name="windowContentOverlay">@null</item> + <item name="windowCloseOnTouchOutside">false</item> + <item name="alertDialogStyle">@style/AlertDialog.Leanback</item> + </style> +</resources> diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index ae6aeee..4ee8103 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -4777,9 +4777,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.post(new Runnable() { @Override public void run() { if (mBootMsgDialog == null) { - int theme = mContext.getPackageManager().hasSystemFeature( - PackageManager.FEATURE_WATCH) ? - com.android.internal.R.style.Theme_Micro_Dialog_Alert : 0; + int theme; + if (mContext.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_WATCH)) { + theme = com.android.internal.R.style.Theme_Micro_Dialog_Alert; + } else if (mContext.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_TELEVISION)) { + theme = com.android.internal.R.style.Theme_Leanback_Dialog_Alert; + } else { + theme = 0; + } mBootMsgDialog = new ProgressDialog(mContext, theme) { // This dialog will consume all events coming in to |