diff --git a/api/current.xml b/api/current.xml
index 914dc26d6d2a8..b1f8f4500cd50 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2235,7 +2235,7 @@
type="int"
transient="false"
volatile="false"
- value="16843601"
+ value="16843602"
static="true"
final="true"
deprecated="not deprecated"
@@ -2246,7 +2246,7 @@
type="int"
transient="false"
volatile="false"
- value="16843600"
+ value="16843601"
static="true"
final="true"
deprecated="not deprecated"
@@ -2257,7 +2257,7 @@
type="int"
transient="false"
volatile="false"
- value="16843602"
+ value="16843603"
static="true"
final="true"
deprecated="not deprecated"
@@ -2374,6 +2374,17 @@
visibility="public"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
0
- && (mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE)
- || (mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING)) {
- super.addView(new DividerView(mContext), index, makeDividerLayoutParams());
- if (index >= 0) {
- index++;
+ if (mButtonBackgroundRes != 0) {
+ // Preserve original padding as we change the background
+ final int paddingLeft = child.getPaddingLeft();
+ final int paddingRight = child.getPaddingRight();
+ final int paddingTop = child.getPaddingTop();
+ final int paddingBottom = child.getPaddingBottom();
+ child.setBackgroundResource(mButtonBackgroundRes);
+ child.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
+ }
+
+ super.addView(child, index, params);
+ }
+
+ @Override
+ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ // Add the extra size that dividers contribute.
+ int dividerCount = 0;
+ if ((mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE) {
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ if (getChildAt(i).getVisibility() != GONE) {
+ dividerCount++;
+ }
+ }
+ dividerCount = Math.max(0, dividerCount);
+ }
+ if ((mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING) {
+ dividerCount++;
+ }
+ if ((mShowDividers & SHOW_DIVIDER_END) == SHOW_DIVIDER_END) {
+ dividerCount++;
+ }
+
+ if (getOrientation() == VERTICAL) {
+ final int dividerSize = mDividerHeight * dividerCount;
+ setMeasuredDimension(getMeasuredWidth(),
+ resolveSize(getMeasuredHeight() + dividerSize, heightMeasureSpec));
+ } else {
+ final int dividerSize = mDividerWidth * dividerCount;
+ setMeasuredDimension(resolveSize(getMeasuredWidth() + dividerSize, widthMeasureSpec),
+ getMeasuredHeight());
+ }
+ }
+
+ @Override
+ public void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+
+ final boolean begin = (mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING;
+ final boolean middle = (mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE;
+
+ // Offset children to leave space for dividers.
+ if (getOrientation() == VERTICAL) {
+ int offset = begin ? mDividerHeight : 0;
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View child = getChildAt(i);
+ child.offsetTopAndBottom(offset);
+ if (middle && child.getVisibility() != GONE) {
+ offset += mDividerHeight;
+ }
+ }
+ } else {
+ int offset = begin ? mDividerWidth : 0;
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View child = getChildAt(i);
+ child.offsetLeftAndRight(offset);
+ if (middle && child.getVisibility() != GONE) {
+ offset += mDividerWidth;
}
}
}
-
- // Preserve original padding as we change the background
- final int paddingLeft = child.getPaddingLeft();
- final int paddingRight = child.getPaddingRight();
- final int paddingTop = child.getPaddingTop();
- final int paddingBottom = child.getPaddingBottom();
- child.setBackgroundDrawable(mButtonBackground);
- child.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
-
- final boolean isLast = index < 0 || index == getChildCount();
- super.addView(child, index, params);
-
- if (index >= 0) {
- index++;
- }
- if ((isLast && (mShowDividers & SHOW_DIVIDER_END) == SHOW_DIVIDER_END) ||
- ((mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE &&
- !(getChildAt(index) instanceof DividerView))) {
- super.addView(new DividerView(mContext), index, makeDividerLayoutParams());
- }
- }
-
- private boolean hasDividerBefore(int index) {
- if (index == -1) {
- index = getChildCount();
- }
- index--;
- if (index < 0) {
- return false;
- }
- return getChildAt(index) instanceof DividerView;
}
- private LayoutParams makeDividerLayoutParams() {
- return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
- }
+ @Override
+ public void dispatchDraw(Canvas canvas) {
+ final boolean begin = (mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING;
+ final boolean middle = (mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE;
+ final boolean end = (mShowDividers & SHOW_DIVIDER_END) == SHOW_DIVIDER_END;
+ final boolean vertical = getOrientation() == VERTICAL;
- private class DividerView extends ImageView {
- public DividerView(Context context) {
- super(context);
- setImageDrawable(mDivider);
- setScaleType(ImageView.ScaleType.FIT_XY);
+ final Rect bounds = mTempRect;
+ bounds.left = mPaddingLeft;
+ bounds.right = mRight - mLeft - mPaddingRight;
+ bounds.top = mPaddingTop;
+ bounds.bottom = mBottom - mTop - mPaddingBottom;
+
+ if (begin) {
+ if (vertical) {
+ bounds.bottom = bounds.top + mDividerHeight;
+ } else {
+ bounds.right = bounds.left + mDividerWidth;
+ }
+ mDivider.setBounds(bounds);
+ mDivider.draw(canvas);
}
+
+ final int childCount = getChildCount();
+ int i = 0;
+ while (i < childCount) {
+ final View child = getChildAt(i);
+ i++;
+ if ((middle && i < childCount && child.getVisibility() != GONE) || end) {
+ if (vertical) {
+ bounds.top = child.getBottom();
+ bounds.bottom = bounds.top + mDividerHeight;
+ } else {
+ bounds.left = child.getRight();
+ bounds.right = bounds.left + mDividerWidth;
+ }
+ mDivider.setBounds(bounds);
+ mDivider.draw(canvas);
+ }
+ }
+
+ super.dispatchDraw(canvas);
}
}
diff --git a/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_dark.9.png
new file mode 100644
index 0000000000000..77b0999850e34
Binary files /dev/null and b/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_dark.9.png differ
diff --git a/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_light.9.png
new file mode 100644
index 0000000000000..3fde76e3421a0
Binary files /dev/null and b/core/res/res/drawable-hdpi/dialog_divider_horizontal_holo_light.9.png differ
diff --git a/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_dark.9.png
new file mode 100644
index 0000000000000..77b0999850e34
Binary files /dev/null and b/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_dark.9.png differ
diff --git a/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_light.9.png
new file mode 100644
index 0000000000000..3fde76e3421a0
Binary files /dev/null and b/core/res/res/drawable-mdpi/dialog_divider_horizontal_holo_light.9.png differ
diff --git a/core/res/res/layout-xlarge/alert_dialog.xml b/core/res/res/layout-xlarge/alert_dialog.xml
index 5291e9dc44fb8..82b450957f530 100644
--- a/core/res/res/layout-xlarge/alert_dialog.xml
+++ b/core/res/res/layout-xlarge/alert_dialog.xml
@@ -107,7 +107,8 @@
android:layout_height="wrap_content"
android:minHeight="54dip"
android:orientation="vertical" >
-
-
+
diff --git a/core/res/res/layout/alert_dialog.xml b/core/res/res/layout/alert_dialog.xml
index 541d84d62edb4..3982ed9c159bc 100644
--- a/core/res/res/layout/alert_dialog.xml
+++ b/core/res/res/layout/alert_dialog.xml
@@ -106,7 +106,8 @@
android:layout_height="wrap_content"
android:minHeight="54dip"
android:orientation="vertical" >
-
-
+
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 578191a1fdb1f..b419a91ea4184 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -347,6 +347,7 @@
+
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index da068dc0927f4..2490c0fc1265b 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1369,6 +1369,7 @@
+
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 4deb97dc2bfc3..2ecb4d0c3e984 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -994,9 +994,8 @@
@@ -1275,6 +1274,12 @@
+
+
+
+
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 9dbb1deb5ac6f..06c502b8f4040 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -89,7 +89,7 @@
- @android:style/Widget.Button.Toggle
- - ?android:attr/listChoiceBackgroundIndicator
+ - @android:drawable/btn_default
- 64dip
@@ -141,6 +141,7 @@
- @android:style/AlertDialog
- @android:style/Theme.Dialog
- @android:style/Theme.Dialog.Alert
+ - ?android:attr/buttonGroupStyle
- @android:drawable/menu_background
@@ -743,6 +744,7 @@
- @android:style/AlertDialog.Holo
- @android:style/Theme.Holo.Dialog
- @android:style/Theme.Holo.Dialog.Alert
+ - @android:style/Widget.Holo.ButtonGroup.AlertDialog
- @android:drawable/menu_background
@@ -972,6 +974,7 @@
- @android:style/AlertDialog.Holo.Light
- @android:style/Theme.Holo.Light.Dialog
- @android:style/Theme.Holo.Light.Dialog.Alert
+ - @android:style/Widget.Holo.Light.ButtonGroup.AlertDialog
- @android:drawable/menu_background