diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java
index 753c0691222e0..b7ac6008a1fdc 100644
--- a/core/java/com/android/internal/app/AlertController.java
+++ b/core/java/com/android/internal/app/AlertController.java
@@ -516,9 +516,15 @@ public class AlertController {
}
// Only show the divider if we have a title.
- final View divider;
+ View divider = null;
if (mMessage != null || mListView != null || hasCustomPanel) {
- divider = topPanel.findViewById(R.id.titleDivider);
+ if (!hasCustomPanel) {
+ divider = topPanel.findViewById(R.id.titleDividerNoCustom);
+ }
+ if (divider == null) {
+ divider = topPanel.findViewById(R.id.titleDivider);
+ }
+
} else {
divider = topPanel.findViewById(R.id.titleDividerTop);
}
@@ -526,6 +532,17 @@ public class AlertController {
if (divider != null) {
divider.setVisibility(View.VISIBLE);
}
+ } else {
+ if (contentPanel != null) {
+ final View spacer = contentPanel.findViewById(R.id.textSpacerNoTitle);
+ if (spacer != null) {
+ spacer.setVisibility(View.VISIBLE);
+ }
+ }
+ }
+
+ if (mListView instanceof RecycleListView) {
+ ((RecycleListView) mListView).setHasDecor(hasTopPanel, hasButtonPanel);
}
// Update scroll indicators as needed.
@@ -861,23 +878,34 @@ public class AlertController {
}
public static class RecycleListView extends ListView {
+ private final int mPaddingTopNoTitle;
+ private final int mPaddingBottomNoButtons;
+
boolean mRecycleOnMeasure = true;
public RecycleListView(Context context) {
- super(context);
+ this(context, null);
}
public RecycleListView(Context context, AttributeSet attrs) {
super(context, attrs);
+
+ final TypedArray ta = context.obtainStyledAttributes(
+ attrs, R.styleable.RecycleListView);
+ mPaddingBottomNoButtons = ta.getDimensionPixelOffset(
+ R.styleable.RecycleListView_paddingBottomNoButtons, -1);
+ mPaddingTopNoTitle = ta.getDimensionPixelOffset(
+ R.styleable.RecycleListView_paddingTopNoTitle, -1);
}
- public RecycleListView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- public RecycleListView(
- Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
+ public void setHasDecor(boolean hasTitle, boolean hasButtons) {
+ if (!hasButtons || !hasTitle) {
+ final int paddingLeft = getPaddingLeft();
+ final int paddingTop = hasTitle ? getPaddingTop() : mPaddingTopNoTitle;
+ final int paddingRight = getPaddingRight();
+ final int paddingBottom = hasButtons ? getPaddingBottom() : mPaddingBottomNoButtons;
+ setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
+ }
}
@Override
diff --git a/core/res/res/layout/alert_dialog_material.xml b/core/res/res/layout/alert_dialog_material.xml
index 9f5093799cd9c..6d33de6ca307d 100644
--- a/core/res/res/layout/alert_dialog_material.xml
+++ b/core/res/res/layout/alert_dialog_material.xml
@@ -34,7 +34,6 @@
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/dialog_padding_top_material"
android:clipToPadding="false">
+
+
diff --git a/core/res/res/layout/alert_dialog_title_material.xml b/core/res/res/layout/alert_dialog_title_material.xml
index 738a6373b3381..eef95859cab64 100644
--- a/core/res/res/layout/alert_dialog_title_material.xml
+++ b/core/res/res/layout/alert_dialog_title_material.xml
@@ -21,6 +21,8 @@
android:layout_height="wrap_content"
android:orientation="vertical">
+
+
-
+
diff --git a/core/res/res/layout/app_anr_dialog.xml b/core/res/res/layout/app_anr_dialog.xml
index 8bef116fa89ea..5ad0f4c0f6cc7 100644
--- a/core/res/res/layout/app_anr_dialog.xml
+++ b/core/res/res/layout/app_anr_dialog.xml
@@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/aerr_padding_list_top"
- android:paddingBottom="@dimen/dialog_list_padding_vertical_material">
+ android:paddingBottom="@dimen/aerr_padding_list_bottom">