diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-08-13 12:17:42 -0700 |
|---|---|---|
| committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-08-16 12:53:16 -0700 |
| commit | 23c89fd1685a006957dc0f2aacf167b4449f3d80 (patch) | |
| tree | b65dc338dbf8bedb2f9011cc858818daf908d315 /core/java/android/widget/CheckedTextView.java | |
| parent | 38cc2a5a3ad076fbbb0824a91f49730a4297549b (diff) | |
Improve resolution of RTL related properties
- fix bug #6887370 ListPreference shows misaligned radio drawables (in CheckedTextView?)
- fix bug #6938146 "Show more cards..." text on bottom button is not centered
- also defer scrollbar initialization as we need resolved padding values for them
Change-Id: Ife651ffe6bbcc228ff6724f3d9b91079fac3a740
Diffstat (limited to 'core/java/android/widget/CheckedTextView.java')
| -rw-r--r-- | core/java/android/widget/CheckedTextView.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 46079f937201..f91201a6973d 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -151,7 +151,7 @@ public class CheckedTextView extends TextView implements Checkable { mCheckMarkWidth = 0; } mCheckMarkDrawable = d; - // Do padding resolution. This will call setPadding() and do a requestLayout() if needed. + // Do padding resolution. This will call internalSetPadding() and do a requestLayout() if needed. resolvePadding(); } @@ -169,6 +169,19 @@ public class CheckedTextView extends TextView implements Checkable { return mCheckMarkDrawable; } + /** + * @hide + */ + @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; + } + } + @Override public void onPaddingChanged(int layoutDirection) { int newPadding = (mCheckMarkDrawable != null) ? @@ -221,8 +234,15 @@ public class CheckedTextView extends TextView implements Checkable { final int width = getWidth(); final int top = y; final int bottom = top + height; - final int left = isLayoutRtl ? getPaddingEnd() : width - getPaddingEnd(); - final int right = left + mCheckMarkWidth; + final int left; + final int right; + if (isLayoutRtl) { + right = getPaddingEnd(); + left = right - mCheckMarkWidth; + } else { + left = width - getPaddingEnd(); + right = left + mCheckMarkWidth; + } checkMarkDrawable.setBounds( left, top, right, bottom); checkMarkDrawable.draw(canvas); } |
