OSDN Git Service

Finish materializing dialogs
authorAdam Powell <adamp@google.com>
Mon, 15 Sep 2014 21:30:23 +0000 (14:30 -0700)
committerAdam Powell <adamp@google.com>
Mon, 15 Sep 2014 21:30:23 +0000 (14:30 -0700)
Fix bottom spacing for dialogs with no button bar

Remove default dividers from dialog lists

Bug 17503404

Change-Id: Icdcaaad99f70a259ff3f892d6385257801e38437

core/java/com/android/internal/app/AlertController.java
core/res/res/layout/alert_dialog_material.xml
core/res/res/values/symbols.xml
core/res/res/values/themes_material.xml

index 6d5c98e..0183e45 100644 (file)
@@ -461,6 +461,10 @@ public class AlertController {
         final View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
         if (!hasButtons) {
             buttonPanel.setVisibility(View.GONE);
+            final View spacer = mWindow.findViewById(R.id.textSpacerNoButtons);
+            if (spacer != null) {
+                spacer.setVisibility(View.VISIBLE);
+            }
             mWindow.setCloseOnTouchOutsideIfNotSet(true);
         }
 
index e5ef629..54a1061 100644 (file)
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:clipToPadding="false">
-            <TextView android:id="@+id/message"
-                style="?attr/textAppearanceMedium"
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:paddingStart="@dimen/alert_dialog_padding_material"
-                android:paddingTop="@dimen/alert_dialog_padding_top_material"
-                android:paddingEnd="@dimen/alert_dialog_padding_material" />
+                android:orientation="vertical">
+                <TextView android:id="@+id/message"
+                          style="?attr/textAppearanceMedium"
+                          android:layout_width="match_parent"
+                          android:layout_height="wrap_content"
+                          android:paddingStart="@dimen/alert_dialog_padding_material"
+                          android:paddingTop="@dimen/alert_dialog_padding_top_material"
+                          android:paddingEnd="@dimen/alert_dialog_padding_material" />
+                <Space android:id="@+id/textSpacerNoButtons"
+                       android:visibility="gone"
+                       android:layout_width="0dp"
+                       android:layout_height="@dimen/alert_dialog_padding_top_material" />
+            </LinearLayout>
         </ScrollView>
     </LinearLayout>
 
index dfd3071..abbf775 100644 (file)
   <java-symbol type="array" name="config_default_vm_number" />
   <java-symbol type="integer" name="config_cdma_3waycall_flash_delay"/>
   <java-symbol type="attr" name="windowBackgroundFallback" />
+  <java-symbol type="id" name="textSpacerNoButtons" />
 </resources>
index aefca72..a984cfa 100644 (file)
@@ -129,7 +129,7 @@ please see themes_device_defaults.xml.
         <item name="listChoiceBackgroundIndicator">?attr/selectableItemBackground</item>
         <item name="activatedBackgroundIndicator">@drawable/activated_background_material</item>
 
-        <item name="listDividerAlertDialog">@drawable/list_divider_material</item>
+        <item name="listDividerAlertDialog">@null</item>
 
         <item name="expandableListPreferredItemPaddingLeft">40dip</item>
         <item name="expandableListPreferredChildPaddingLeft">?attr/expandableListPreferredItemPaddingLeft</item>
@@ -481,7 +481,7 @@ please see themes_device_defaults.xml.
         <item name="expandableListPreferredChildIndicatorLeft">?attr/expandableListPreferredItemIndicatorLeft</item>
         <item name="expandableListPreferredChildIndicatorRight">?attr/expandableListPreferredItemIndicatorRight</item>
 
-        <item name="listDividerAlertDialog">@drawable/list_divider_material</item>
+        <item name="listDividerAlertDialog">@null</item>
         <item name="findOnPageNextDrawable">@drawable/ic_find_next_material</item>
         <item name="findOnPagePreviousDrawable">@drawable/ic_find_previous_material</item>
 
@@ -1015,6 +1015,8 @@ please see themes_device_defaults.xml.
         <item name="listPreferredItemPaddingStart">16dip</item>
         <item name="listPreferredItemPaddingEnd">16dip</item>
 
+        <item name="listDivider">@null</item>
+
         <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
     </style>
 
@@ -1127,6 +1129,8 @@ please see themes_device_defaults.xml.
         <item name="listPreferredItemPaddingStart">16dip</item>
         <item name="listPreferredItemPaddingEnd">16dip</item>
 
+        <item name="listDivider">@null</item>
+
         <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
     </style>