Fix again bug #6887370 ListPreference shows misaligned radio drawables (in CheckedTextView?)
Change-Id: Ia377cc95cd64f2df0a258b9ea3f709e6094f395e
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index f91201a..bc78adc 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -175,11 +175,7 @@
@Override
protected void internalSetPadding(int left, int top, int right, int bottom) {
super.internalSetPadding(left, top, right, bottom);
- if (isLayoutRtl()) {
- mBasePadding = mUserPaddingLeft;
- } else {
- mBasePadding = mUserPaddingRight;
- }
+ setBasePadding(isLayoutRtl());
}
@Override
@@ -201,13 +197,21 @@
@Override
public void setPadding(int left, int top, int right, int bottom) {
super.setPadding(left, top, right, bottom);
- mBasePadding = getPaddingEnd();
+ setBasePadding(isLayoutRtl());
}
@Override
public void setPaddingRelative(int start, int top, int end, int bottom) {
super.setPaddingRelative(start, top, end, bottom);
- mBasePadding = getPaddingEnd();
+ setBasePadding(isLayoutRtl());
+ }
+
+ private void setBasePadding(boolean isLayoutRtl) {
+ if (isLayoutRtl) {
+ mBasePadding = mPaddingLeft;
+ } else {
+ mBasePadding = mPaddingRight;
+ }
}
@Override
@@ -237,11 +241,11 @@
final int left;
final int right;
if (isLayoutRtl) {
- right = getPaddingEnd();
- left = right - mCheckMarkWidth;
- } else {
- left = width - getPaddingEnd();
+ left = mBasePadding;
right = left + mCheckMarkWidth;
+ } else {
+ right = width - mBasePadding;
+ left = right - mCheckMarkWidth;
}
checkMarkDrawable.setBounds( left, top, right, bottom);
checkMarkDrawable.draw(canvas);