Merge "Fix Material styling in remaining dialogs and layouts" into lmp-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index a832ef0..14567f2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -475,6 +475,7 @@
     field public static final int dialogLayout = 16843255; // 0x10101f7
     field public static final int dialogMessage = 16843251; // 0x10101f3
     field public static final int dialogPreferenceStyle = 16842897; // 0x1010091
+    field public static final int dialogPreferredPadding = 16844037; // 0x1010505
     field public static final int dialogTheme = 16843528; // 0x1010308
     field public static final int dialogTitle = 16843250; // 0x10101f2
     field public static final int digits = 16843110; // 0x1010166
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 216a901..b03103e 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2940,7 +2940,7 @@
                 android:label="@string/managed_profile_label">
         </activity-alias>
         <activity android:name="com.android.internal.app.HeavyWeightSwitcherActivity"
-                android:theme="@style/Theme.Material.Dialog"
+                android:theme="@style/Theme.Material.Light.Dialog"
                 android:label="@string/heavy_weight_switcher_title"
                 android:finishOnCloseSystemDialogs="true"
                 android:excludeFromRecents="true"
@@ -2960,7 +2960,7 @@
         <activity android:name="android.accounts.ChooseAccountActivity"
                 android:excludeFromRecents="true"
                 android:exported="true"
-                android:theme="@android:style/Theme.Material.Dialog"
+                android:theme="@style/Theme.Material.Light.Dialog"
                 android:label="@string/choose_account_label"
                 android:process=":ui">
         </activity>
@@ -2968,14 +2968,14 @@
         <activity android:name="android.accounts.ChooseTypeAndAccountActivity"
                 android:excludeFromRecents="true"
                 android:exported="true"
-                android:theme="@android:style/Theme.Material.Dialog"
+                android:theme="@style/Theme.Material.Light.Dialog"
                 android:label="@string/choose_account_label"
                 android:process=":ui">
         </activity>
 
         <activity android:name="android.accounts.ChooseAccountTypeActivity"
                 android:excludeFromRecents="true"
-                android:theme="@android:style/Theme.Material.Dialog"
+                android:theme="@style/Theme.Material.Light.Dialog"
                 android:label="@string/choose_account_label"
                 android:process=":ui">
         </activity>
@@ -2983,19 +2983,19 @@
         <activity android:name="android.accounts.CantAddAccountActivity"
                 android:excludeFromRecents="true"
                 android:exported="true"
-                android:theme="@android:style/Theme.Material.Dialog.NoActionBar"
+                android:theme="@style/Theme.Material.Light.Dialog.NoActionBar"
                 android:process=":ui">
         </activity>
 
         <activity android:name="android.accounts.GrantCredentialsPermissionActivity"
                 android:excludeFromRecents="true"
                 android:exported="true"
-                android:theme="@android:style/Theme.Material.DialogWhenLarge"
+                android:theme="@style/Theme.Material.Light.DialogWhenLarge"
                 android:process=":ui">
         </activity>
 
         <activity android:name="android.content.SyncActivityTooManyDeletes"
-               android:theme="@android:style/Theme.Holo.Dialog"
+               android:theme="@style/Theme.Material.Light.Dialog"
                android:label="@string/sync_too_many_deletes"
                android:process=":ui">
         </activity>
@@ -3014,7 +3014,7 @@
         </activity>
 
         <activity android:name="com.android.internal.app.NetInitiatedActivity"
-                android:theme="@style/Theme.Holo.Dialog.Alert"
+                android:theme="@style/Theme.Material.Light.Dialog.Alert"
                 android:excludeFromRecents="true"
                 android:process=":ui">
         </activity>
diff --git a/core/res/res/layout/activity_chooser_view_list_item.xml b/core/res/res/layout/activity_chooser_view_list_item.xml
index af70234..66e400a 100644
--- a/core/res/res/layout/activity_chooser_view_list_item.xml
+++ b/core/res/res/layout/activity_chooser_view_list_item.xml
@@ -17,11 +17,11 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/list_item"
     android:layout_width="match_parent"
-    android:layout_height="?android:attr/dropdownListPreferredItemHeight"
-    android:paddingStart="16dip"
-    android:paddingEnd="16dip"
+    android:layout_height="?attr/dropdownListPreferredItemHeight"
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?attr/listPreferredItemPaddingEnd"
     android:minWidth="196dip"
-    android:background="?android:attr/activatedBackgroundIndicator"
+    android:background="?attr/activatedBackgroundIndicator"
     android:orientation="vertical" >
 
     <LinearLayout
@@ -42,7 +42,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
-            android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
+            android:textAppearance="?attr/textAppearanceLargePopupMenu"
             android:duplicateParentState="true"
             android:singleLine="true"
             android:ellipsize="marquee"
diff --git a/core/res/res/layout/activity_list_item_2.xml b/core/res/res/layout/activity_list_item_2.xml
index a5a4cf9..608e986 100644
--- a/core/res/res/layout/activity_list_item_2.xml
+++ b/core/res/res/layout/activity_list_item_2.xml
@@ -17,9 +17,9 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceListItemSmall"
+    android:minHeight="?attr/listPreferredItemHeight"
+    android:textAppearance="?attr/textAppearanceListItemSmall"
     android:gravity="center_vertical"
     android:drawablePadding="14dip"
-    android:paddingStart="16dip"
-    android:paddingEnd="16dip" />
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?attr/listPreferredItemPaddingEnd" />
diff --git a/core/res/res/layout/alert_dialog_material.xml b/core/res/res/layout/alert_dialog_material.xml
index 5627a2c..29bfaa7 100644
--- a/core/res/res/layout/alert_dialog_material.xml
+++ b/core/res/res/layout/alert_dialog_material.xml
@@ -31,9 +31,9 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:gravity="center_vertical|start"
-            android:paddingStart="@dimen/alert_dialog_padding_material"
-            android:paddingEnd="@dimen/alert_dialog_padding_material"
-            android:paddingTop="@dimen/alert_dialog_padding_top_material">
+            android:paddingStart="?attr/dialogPreferredPadding"
+            android:paddingEnd="?attr/dialogPreferredPadding"
+            android:paddingTop="@dimen/dialog_padding_top_material">
             <ImageView android:id="@+id/icon"
                 android:layout_width="32dip"
                 android:layout_height="32dip"
@@ -74,13 +74,13 @@
                           style="@style/TextAppearance.Material.Subhead"
                           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:paddingStart="?attr/dialogPreferredPadding"
+                          android:paddingTop="@dimen/dialog_padding_top_material"
+                          android:paddingEnd="?attr/dialogPreferredPadding" />
                 <Space android:id="@+id/textSpacerNoButtons"
                        android:visibility="gone"
                        android:layout_width="0dp"
-                       android:layout_height="@dimen/alert_dialog_padding_top_material" />
+                       android:layout_height="@dimen/dialog_padding_top_material" />
             </LinearLayout>
         </ScrollView>
         <View android:id="@+id/scrollIndicatorDown"
diff --git a/core/res/res/layout/alert_dialog_progress_material.xml b/core/res/res/layout/alert_dialog_progress_material.xml
index d005a44..9c21540 100644
--- a/core/res/res/layout/alert_dialog_progress_material.xml
+++ b/core/res/res/layout/alert_dialog_progress_material.xml
@@ -18,10 +18,10 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
     android:layout_height="match_parent"
-    android:paddingStart="@dimen/alert_dialog_padding_material"
-    android:paddingTop="@dimen/alert_dialog_padding_top_material"
-    android:paddingEnd="@dimen/alert_dialog_padding_material"
-    android:paddingBottom="@dimen/alert_dialog_padding_top_material">
+    android:paddingStart="?attr/dialogPreferredPadding"
+    android:paddingTop="@dimen/dialog_padding_top_material"
+    android:paddingEnd="?attr/dialogPreferredPadding"
+    android:paddingBottom="@dimen/dialog_padding_top_material">
     <ProgressBar
         android:id="@+id/progress"
         style="?attr/progressBarStyleHorizontal"
diff --git a/core/res/res/layout/app_not_authorized.xml b/core/res/res/layout/app_not_authorized.xml
index 2188511..339b24e 100644
--- a/core/res/res/layout/app_not_authorized.xml
+++ b/core/res/res/layout/app_not_authorized.xml
@@ -26,30 +26,33 @@
     <TextView android:id="@+id/description"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
         android:layout_gravity="start|center_vertical"
-        android:paddingTop="16dip"
-        android:paddingBottom="16dip"
-        android:paddingStart="16dip"
-        android:paddingEnd="16dip"
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingTop="@dimen/dialog_padding_top_material"
+        android:paddingEnd="?attr/dialogPreferredPadding"
         android:text="@string/error_message_change_not_allowed"
-    />
+        style="@style/TextAppearance.Material.Subhead" />
 
-    <!-- Horizontal divider line -->
-    <View android:layout_height="1dip"
-        android:layout_width="match_parent"
-        android:background="?android:attr/dividerHorizontal" />
-
-    <!-- Alert dialog style buttons along the bottom. -->
-    <LinearLayout android:id="@+id/button_bar"
-        style="?android:attr/buttonBarStyle"
+    <LinearLayout android:id="@+id/buttonPanel"
+        style="?attr/buttonBarStyle"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:measureWithLargestChild="true">
-        <Button android:id="@android:id/button1"
-            style="?android:attr/buttonBarButtonStyle"
-            android:layout_width="wrap_content" android:layout_height="wrap_content"
+        android:layoutDirection="locale"
+        android:orientation="horizontal"
+        android:paddingStart="12dp"
+        android:paddingEnd="12dp"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp"
+        android:gravity="bottom">
+        <Space
+            android:layout_width="0dp"
+            android:layout_height="0dp"
             android:layout_weight="1"
+            android:visibility="invisible" />
+        <Button android:id="@+id/button1"
+            style="?attr/buttonBarNegativeButtonStyle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:text="@android:string/yes"
             android:onClick="onCancelButtonClicked" />
     </LinearLayout>
diff --git a/core/res/res/layout/choose_account.xml b/core/res/res/layout/choose_account.xml
index 45a944e..e13dd26 100644
--- a/core/res/res/layout/choose_account.xml
+++ b/core/res/res/layout/choose_account.xml
@@ -21,11 +21,11 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
-    android:paddingStart="16dip"
-    android:paddingEnd="16dip">
+    android:paddingStart="?attr/dialogPreferredPadding"
+    android:paddingEnd="?attr/dialogPreferredPadding">
 
     <ListView xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@android:id/list"
+        android:id="@id/list"
         android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1"
diff --git a/core/res/res/layout/choose_account_row.xml b/core/res/res/layout/choose_account_row.xml
index c4247b6..71537fb 100644
--- a/core/res/res/layout/choose_account_row.xml
+++ b/core/res/res/layout/choose_account_row.xml
@@ -18,8 +18,8 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:paddingStart="16dip"
-    android:paddingEnd="16dip"
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?attr/listPreferredItemPaddingEnd"
     android:orientation="horizontal" >
 
    <ImageView android:id="@+id/account_row_icon"
@@ -31,8 +31,8 @@
         android:id="@+id/account_row_text"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textAppearance="?android:attr/textAppearanceListItem"
         android:gravity="center_vertical"
-        android:minHeight="?android:attr/listPreferredItemHeight" />
+        android:minHeight="?attr/listPreferredItemHeight" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/core/res/res/layout/choose_type_and_account.xml b/core/res/res/layout/choose_type_and_account.xml
index bf06054..79f3f1a 100644
--- a/core/res/res/layout/choose_type_and_account.xml
+++ b/core/res/res/layout/choose_type_and_account.xml
@@ -26,45 +26,52 @@
     <TextView android:id="@+id/description"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
         android:layout_gravity="start|center_vertical"
-        android:paddingTop="16dip"
-        android:paddingBottom="16dip"
-        android:paddingStart="16dip"
-        android:paddingEnd="16dip"
-    />
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingTop="@dimen/dialog_padding_top_material"
+        android:paddingEnd="?attr/dialogPreferredPadding"
+        style="@style/TextAppearance.Material.Subhead" />
 
-    <!-- List of accounts, with "Add new account" as the last item -->
-    <ListView android:id="@android:id/list"
+    <FrameLayout android:id="@+id/contentPanel"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:drawSelectorOnTop="false"
         android:layout_weight="1"
-        android:scrollbarAlwaysDrawVerticalTrack="true"
-        android:choiceMode="singleChoice" />
+        android:minHeight="48dp">
+        <ListView android:id="@id/list"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:drawSelectorOnTop="false"
+            android:layout_weight="1"
+            android:scrollbarAlwaysDrawVerticalTrack="true"
+            android:choiceMode="singleChoice" />
+    </FrameLayout>
 
-    <!-- Horizontal divider line -->
-    <View android:layout_height="1dip"
-        android:layout_width="match_parent"
-        android:background="?android:attr/dividerHorizontal" />
-
-    <!-- Alert dialog style buttons along the bottom. -->
-    <LinearLayout android:id="@+id/button_bar"
-        style="?android:attr/buttonBarStyle"
+    <LinearLayout android:id="@+id/buttonPanel"
+        style="?attr/buttonBarStyle"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:measureWithLargestChild="true">
-        <Button android:id="@android:id/button1"
-            style="?android:attr/buttonBarButtonStyle"
-            android:layout_width="wrap_content" android:layout_height="wrap_content"
+        android:layoutDirection="locale"
+        android:orientation="horizontal"
+        android:paddingStart="12dp"
+        android:paddingEnd="12dp"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp"
+        android:gravity="bottom">
+        <Space
+            android:layout_width="0dp"
+            android:layout_height="0dp"
             android:layout_weight="1"
-            android:text="@android:string/no"
-            android:onClick="onCancelButtonClicked" />
-        <Button android:id="@android:id/button2"
-            style="?android:attr/buttonBarButtonStyle"
+            android:visibility="invisible" />
+        <Button android:id="@+id/button1"
+            style="?attr/buttonBarNegativeButtonStyle"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_weight="1"
+            android:text="@android:string/no"
+            android:onClick="onCancelButtonClicked" />
+        <Button android:id="@+id/button2"
+            style="?attr/buttonBarPositiveButtonStyle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:text="@android:string/yes"
             android:onClick="onOkButtonClicked" />
     </LinearLayout>
diff --git a/core/res/res/layout/dialog_title_icons_material.xml b/core/res/res/layout/dialog_title_icons_material.xml
index 21396da..62af096 100644
--- a/core/res/res/layout/dialog_title_icons_material.xml
+++ b/core/res/res/layout/dialog_title_icons_material.xml
@@ -28,9 +28,9 @@
         android:layout_height="wrap_content"
         android:orientation="horizontal"
         android:gravity="center_vertical"
-        android:paddingStart="@dimen/alert_dialog_padding_material"
-        android:paddingEnd="@dimen/alert_dialog_padding_material"
-        android:paddingTop="@dimen/alert_dialog_padding_material">
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingEnd="?attr/dialogPreferredPadding"
+        android:paddingTop="?attr/dialogPreferredPadding">
         <ImageView android:id="@+id/left_icon"
             android:layout_width="32dip"
             android:layout_height="32dip"
diff --git a/core/res/res/layout/dialog_title_material.xml b/core/res/res/layout/dialog_title_material.xml
index fcf6164..339d569 100644
--- a/core/res/res/layout/dialog_title_material.xml
+++ b/core/res/res/layout/dialog_title_material.xml
@@ -29,9 +29,9 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:textAlignment="viewStart"
-        android:paddingStart="@dimen/alert_dialog_padding_material"
-        android:paddingEnd="@dimen/alert_dialog_padding_material"
-        android:paddingTop="@dimen/alert_dialog_padding_top_material" />
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingEnd="?attr/dialogPreferredPadding"
+        android:paddingTop="@dimen/dialog_padding_top_material" />
     <FrameLayout
         android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="1"
diff --git a/core/res/res/layout/locale_picker_item.xml b/core/res/res/layout/locale_picker_item.xml
index 94c9baf..defdd4d 100644
--- a/core/res/res/layout/locale_picker_item.xml
+++ b/core/res/res/layout/locale_picker_item.xml
@@ -19,15 +19,14 @@
     android:layout_height="wrap_content"
     android:layout_width="match_parent"
     android:gravity="center_vertical"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:paddingStart="16dp"
+    android:minHeight="?attr/listPreferredItemHeight"
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?attr/listPreferredItemPaddingEnd"
     android:paddingTop="8dp"
-    android:paddingBottom="8dp"
-    android:paddingEnd="16dp">
+    android:paddingBottom="8dp">
 
     <TextView android:id="@+id/locale"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-    />
-</LinearLayout >
+        android:textAppearance="?android:attr/textAppearanceListItem" />
+</LinearLayout>
diff --git a/core/res/res/layout/popup_menu_item_layout.xml b/core/res/res/layout/popup_menu_item_layout.xml
index 452f85d..0bc636f 100644
--- a/core/res/res/layout/popup_menu_item_layout.xml
+++ b/core/res/res/layout/popup_menu_item_layout.xml
@@ -16,7 +16,7 @@
 
 <com.android.internal.view.menu.ListMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="?android:attr/dropdownListPreferredItemHeight"
+    android:layout_height="?attr/dropdownListPreferredItemHeight"
     android:minWidth="196dip"
     android:paddingEnd="16dip">
     
@@ -37,7 +37,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentTop="true"
             android:layout_alignParentStart="true"
-            android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
+            android:textAppearance="?attr/textAppearanceLargePopupMenu"
             android:singleLine="true"
             android:duplicateParentState="true"
             android:ellipsize="marquee"
@@ -50,7 +50,7 @@
             android:layout_height="wrap_content"
             android:layout_below="@id/title"
             android:layout_alignParentStart="true"
-            android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
+            android:textAppearance="?attr/textAppearanceSmallPopupMenu"
             android:singleLine="true"
             android:duplicateParentState="true"
             android:textAlignment="viewStart" />
diff --git a/core/res/res/layout/progress_dialog_material.xml b/core/res/res/layout/progress_dialog_material.xml
index 54af106..2417965 100644
--- a/core/res/res/layout/progress_dialog_material.xml
+++ b/core/res/res/layout/progress_dialog_material.xml
@@ -25,10 +25,10 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:baselineAligned="false"
-        android:paddingStart="@dimen/alert_dialog_padding_material"
-        android:paddingTop="@dimen/alert_dialog_padding_top_material"
-        android:paddingEnd="@dimen/alert_dialog_padding_material"
-        android:paddingBottom="@dimen/alert_dialog_padding_top_material">
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingTop="@dimen/dialog_padding_top_material"
+        android:paddingEnd="?attr/dialogPreferredPadding"
+        android:paddingBottom="@dimen/dialog_padding_top_material">
 
         <ProgressBar
             android:id="@id/progress"
@@ -36,7 +36,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:max="10000"
-            android:layout_marginEnd="@dimen/alert_dialog_padding_material" />
+            android:layout_marginEnd="?attr/dialogPreferredPadding" />
 
         <TextView
             android:id="@+id/message"
diff --git a/core/res/res/layout/resolve_list_item.xml b/core/res/res/layout/resolve_list_item.xml
index 37c4270..2933a6a 100644
--- a/core/res/res/layout/resolve_list_item.xml
+++ b/core/res/res/layout/resolve_list_item.xml
@@ -32,8 +32,8 @@
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_gravity="start|center_vertical"
-               android:layout_marginStart="16dp"
-               android:layout_marginEnd="16dp"
+               android:layout_marginStart="?attr/listPreferredItemPaddingStart"
+               android:layout_marginEnd="?attr/listPreferredItemPaddingEnd"
                android:layout_marginTop="12dp"
                android:layout_marginBottom="12dp"
                android:scaleType="fitCenter" />
@@ -41,8 +41,8 @@
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:gravity="start|center_vertical"
               android:orientation="vertical"
-              android:paddingStart="16dp"
-              android:paddingEnd="16dp"
+              android:paddingStart="?attr/listPreferredItemPaddingStart"
+              android:paddingEnd="?attr/listPreferredItemPaddingEnd"
               android:layout_height="wrap_content"
               android:layout_width="wrap_content"
               android:layout_gravity="start|center_vertical">
diff --git a/core/res/res/layout/resolver_list.xml b/core/res/res/layout/resolver_list.xml
index 727f9c6..9ae3aec 100644
--- a/core/res/res/layout/resolver_list.xml
+++ b/core/res/res/layout/resolver_list.xml
@@ -23,23 +23,21 @@
     android:maxWidth="@dimen/resolver_max_width"
     android:maxCollapsedHeight="192dp"
     android:maxCollapsedHeightSmall="56dp"
-    android:id="@id/contentPanel"
-    >
+    android:id="@id/contentPanel">
 
     <TextView android:id="@+id/title"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:layout_alwaysShow="true"
               android:minHeight="56dp"
-              android:textAppearance="?android:attr/textAppearanceMedium"
+              android:textAppearance="?attr/textAppearanceMedium"
               android:gravity="start|center_vertical"
-              android:paddingStart="16dp"
-              android:paddingEnd="16dp"
+              android:paddingStart="?attr/dialogPreferredPadding"
+              android:paddingEnd="?attr/dialogPreferredPadding"
               android:paddingTop="8dp"
               android:paddingBottom="8dp"
               android:background="@color/white"
-              android:elevation="8dp"
-              />
+              android:elevation="8dp" />
 
     <ListView
         android:layout_width="match_parent"
@@ -50,8 +48,7 @@
         android:background="@color/white"
         android:elevation="8dp"
         android:nestedScrollingEnabled="true"
-        android:divider="@null"
-        />
+        android:divider="@null" />
 
     <TextView android:id="@+id/empty"
               android:layout_width="match_parent"
diff --git a/core/res/res/layout/select_dialog_multichoice_material.xml b/core/res/res/layout/select_dialog_multichoice_material.xml
index e5b5b62..9cfbbb3 100644
--- a/core/res/res/layout/select_dialog_multichoice_material.xml
+++ b/core/res/res/layout/select_dialog_multichoice_material.xml
@@ -23,8 +23,8 @@
     android:textAppearance="?android:attr/textAppearanceMedium"
     android:textColor="?android:attr/textColorAlertDialogListItem"
     android:gravity="center_vertical"
-    android:paddingStart="@dimen/alert_dialog_padding_material"
-    android:paddingEnd="@dimen/alert_dialog_padding_material"
+    android:paddingStart="?attr/dialogPreferredPadding"
+    android:paddingEnd="?attr/dialogPreferredPadding"
     android:checkMark="?android:attr/listChoiceIndicatorMultiple"
     android:checkMarkGravity="start"
     android:ellipsize="marquee" />
diff --git a/core/res/res/layout/select_dialog_singlechoice_material.xml b/core/res/res/layout/select_dialog_singlechoice_material.xml
index a9e603d..4f8672f 100644
--- a/core/res/res/layout/select_dialog_singlechoice_material.xml
+++ b/core/res/res/layout/select_dialog_singlechoice_material.xml
@@ -23,8 +23,8 @@
     android:textAppearance="?android:attr/textAppearanceMedium"
     android:textColor="?android:attr/textColorAlertDialogListItem"
     android:gravity="center_vertical"
-    android:paddingStart="@dimen/alert_dialog_padding_material"
-    android:paddingEnd="@dimen/alert_dialog_padding_material"
+    android:paddingStart="?attr/dialogPreferredPadding"
+    android:paddingEnd="?attr/dialogPreferredPadding"
     android:checkMark="?android:attr/listChoiceIndicatorSingle"
     android:checkMarkGravity="start"
     android:ellipsize="marquee" />
diff --git a/core/res/res/layout/simple_account_item.xml b/core/res/res/layout/simple_account_item.xml
index e7b746c..29e42af 100644
--- a/core/res/res/layout/simple_account_item.xml
+++ b/core/res/res/layout/simple_account_item.xml
@@ -18,13 +18,13 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:minHeight="?attr/listPreferredItemHeight"
     android:gravity="center_vertical"
-    android:paddingStart="16dip"
-    android:paddingEnd="?android:attr/scrollbarSize">
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?attr/scrollbarSize">
 
     <ImageView
-        android:id="@+android:id/icon"
+        android:id="@id/icon"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"/>
@@ -36,20 +36,20 @@
         android:layout_marginTop="6dip"
         android:layout_marginBottom="6dip"
         android:layout_weight="1">
-        <TextView android:id="@+android:id/title"
+        <TextView android:id="@id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:singleLine="true"
             android:ellipsize="none"
-            android:textAppearance="?android:attr/textAppearanceListItem" />
-        <TextView android:id="@+android:id/summary"
+            android:textAppearance="?attr/textAppearanceListItem" />
+        <TextView android:id="@id/summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_below="@android:id/title"
-            android:layout_alignStart="@android:id/title"
+            android:layout_below="@id/title"
+            android:layout_alignStart="@id/title"
             android:singleLine="true"
             android:ellipsize="none"
-            android:textAppearance="?android:attr/textAppearanceListItemSecondary"
-            android:textColor="?android:attr/textColorSecondary"/>
+            android:textAppearance="?attr/textAppearanceListItemSecondary"
+            android:textColor="?attr/textColorSecondary"/>
     </RelativeLayout>
 </LinearLayout>
diff --git a/core/res/res/layout/simple_list_item_2_single_choice.xml b/core/res/res/layout/simple_list_item_2_single_choice.xml
index 940c6b8..6cdb88b 100644
--- a/core/res/res/layout/simple_list_item_2_single_choice.xml
+++ b/core/res/res/layout/simple_list_item_2_single_choice.xml
@@ -19,7 +19,7 @@
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     android:gravity="center_vertical"
-    android:paddingStart="16dip"
+    android:paddingStart="?attr/listPreferredItemPaddingStart"
     android:paddingEnd="12dip"
     android:minHeight="?attr/listPreferredItemHeightSmall"
     android:background="@color/transparent">
diff --git a/core/res/res/layout/user_switching_dialog.xml b/core/res/res/layout/user_switching_dialog.xml
index 8617e5d..496783a 100644
--- a/core/res/res/layout/user_switching_dialog.xml
+++ b/core/res/res/layout/user_switching_dialog.xml
@@ -21,7 +21,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:gravity="center"
-        android:paddingStart="@dimen/alert_dialog_padding_material"
-        android:paddingEnd="@dimen/alert_dialog_padding_material"
+        android:paddingStart="?attr/dialogPreferredPadding"
+        android:paddingEnd="?attr/dialogPreferredPadding"
         android:paddingTop="24dp"
         android:paddingBottom="24dp" />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index e63fc55..4f8acdb 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -908,12 +908,14 @@
 
         <!-- Theme to use for dialogs spawned from this theme. -->
         <attr name="dialogTheme" format="reference" />
-        <!-- Window decor layout to use in dialog mode with icons -->
+        <!-- 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 -->
+        <!-- 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 -->
+        <!-- Window decor layout to use in dialog mode with title only. -->
         <attr name="dialogTitleDecorLayout" format="reference" />
+        <!-- Preferred padding for dialog content. -->
+        <attr name="dialogPreferredPadding" format="dimension" />
 
         <!-- Theme to use for alert dialogs spawned from this theme. -->
         <attr name="alertDialogTheme" format="reference" />
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 71f66ba..13e3be5 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -123,6 +123,9 @@
          be either a fraction or a dimension. -->
     <item type="dimen" name="dialog_min_width_minor">95%</item>
 
+    <!-- Default padding for dialogs. -->
+    <dimen name="dialog_padding">16dp</dimen>
+
     <!-- The width of the big icons in notifications. -->
     <dimen name="notification_large_icon_width">64dp</dimen>
     <!-- The width of the big icons in notifications. -->
diff --git a/core/res/res/values/dimens_material.xml b/core/res/res/values/dimens_material.xml
index 515922d..4a2119b 100644
--- a/core/res/res/values/dimens_material.xml
+++ b/core/res/res/values/dimens_material.xml
@@ -91,6 +91,6 @@
     <!-- Default rounded corner for controls -->
     <dimen name="control_corner_material">2dp</dimen>
 
-    <dimen name="alert_dialog_padding_material">24dp</dimen>
-    <dimen name="alert_dialog_padding_top_material">18dp</dimen>
+    <dimen name="dialog_padding_material">24dp</dimen>
+    <dimen name="dialog_padding_top_material">18dp</dimen>
 </resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index c0a5ab2..c661c33 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2599,5 +2599,6 @@
     <public type="attr" name="collapseContentDescription"/>
     <public type="attr" name="accessibilityTraversalBefore" />
     <public type="attr" name="accessibilityTraversalAfter" />
+    <public type="attr" name="dialogPreferredPadding" />
 
 </resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index dd87139..5a59afe 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -43,6 +43,10 @@
         <item name="shadowRadius">2.75</item>
     </style>
 
+    <style name="DialogWindowTitleBackground">
+        <item name="background">@drawable/title_bar</item>
+    </style>
+
     <style name="DialogWindowTitle">
         <item name="maxLines">1</item>
         <item name="scrollHorizontally">true</item>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index cc3ded5..e04d901 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -1128,6 +1128,15 @@
         <item name="textAlignment">viewStart</item>
     </style>
 
+    <style name="DialogWindowTitleBackground.Material">
+        <item name="background">@null</item>
+        <item name="paddingStart">?attr/dialogPreferredPadding</item>
+        <item name="paddingEnd">?attr/dialogPreferredPadding</item>
+        <item name="paddingTop">@dimen/dialog_padding_top_material</item>
+    </style>
+
+    <style name="DialogWindowTitleBackground.Material.Light" />
+
     <style name="DialogWindowTitle.Material">
         <item name="maxLines">1</item>
         <item name="scrollHorizontally">true</item>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index d983440..4ba6c0b 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -210,6 +210,7 @@
         <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="dialogPreferredPadding">@dimen/dialog_padding</item>
 
         <!-- AlertDialog attributes -->
         <item name="alertDialogTheme">@style/Theme.Dialog.Alert</item>
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index 5640fc1..b320ae5 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -178,6 +178,7 @@
         <item name="dialogTitleIconsDecorLayout">@layout/dialog_title_icons_material</item>
         <item name="dialogCustomTitleDecorLayout">@layout/dialog_custom_title_material</item>
         <item name="dialogTitleDecorLayout">@layout/dialog_title_material</item>
+        <item name="dialogPreferredPadding">@dimen/dialog_padding_material</item>
 
         <!-- AlertDialog attributes -->
         <item name="alertDialogTheme">@style/Theme.Material.Dialog.Alert</item>
@@ -529,6 +530,7 @@
         <item name="dialogTitleIconsDecorLayout">@layout/dialog_title_icons_material</item>
         <item name="dialogCustomTitleDecorLayout">@layout/dialog_custom_title_material</item>
         <item name="dialogTitleDecorLayout">@layout/dialog_title_material</item>
+        <item name="dialogPreferredPadding">@dimen/dialog_padding_material</item>
 
         <!-- AlertDialog attributes -->
         <item name="alertDialogTheme">@style/Theme.Material.Light.Dialog.Alert</item>
@@ -1001,6 +1003,7 @@
 
         <item name="windowFrame">@null</item>
         <item name="windowTitleStyle">@style/DialogWindowTitle.Material</item>
+        <item name="windowTitleBackgroundStyle">@style/DialogWindowTitleBackground.Material</item>
         <item name="windowBackground">@drawable/dialog_background_material</item>
         <item name="windowElevation">@dimen/floating_window_z</item>
         <item name="windowIsFloating">true</item>
@@ -1117,6 +1120,7 @@
 
         <item name="windowFrame">@null</item>
         <item name="windowTitleStyle">@style/DialogWindowTitle.Material.Light</item>
+        <item name="windowTitleBackgroundStyle">@style/DialogWindowTitleBackground.Material.Light</item>
         <item name="windowBackground">@drawable/dialog_background_material</item>
         <item name="windowElevation">@dimen/floating_window_z</item>
         <item name="windowIsFloating">true</item>