diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2013-11-05 00:46:18 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-11-05 00:46:19 +0000 |
| commit | f48bcd5b68613b0a4ff0162091047fb9465b5290 (patch) | |
| tree | 15f167ec0177cda1315252ad2367c3419523f40c /core/java/android/view/View.java | |
| parent | cad157b370524782183de688bf97c9078c1c08da (diff) | |
| parent | 600d7dd1c6d9d1ff81b71085eff2a6be50d6f36c (diff) | |
| download | frameworks_base-f48bcd5b68613b0a4ff0162091047fb9465b5290.zip frameworks_base-f48bcd5b68613b0a4ff0162091047fb9465b5290.tar.gz frameworks_base-f48bcd5b68613b0a4ff0162091047fb9465b5290.tar.bz2 | |
Merge "Fix bug #11256076 Spinner text is too close from the opening triangle in RTL Locales" into klp-dev
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 53a8300..aa2b0d4 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3102,6 +3102,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static final int UNDEFINED_PADDING = Integer.MIN_VALUE; + private boolean mUseBackgroundPadding = false; + /** * @hide */ @@ -12135,12 +12137,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (!isTextAlignmentResolved()) { resolveTextAlignment(); } - if (!isPaddingResolved()) { - resolvePadding(); - } + // Should resolve Drawables before Padding because we need the layout direction of the + // Drawable to correctly resolve Padding. if (!isDrawablesResolved()) { resolveDrawables(); } + if (!isPaddingResolved()) { + resolvePadding(); + } onRtlPropertiesChanged(getLayoutDirection()); return true; } @@ -12343,6 +12347,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // If start / end padding are defined, they will be resolved (hence overriding) to // left / right or right / left depending on the resolved layout direction. // If start / end padding are not defined, use the left / right ones. + if (mBackground != null && mUseBackgroundPadding) { + Rect padding = sThreadLocal.get(); + if (padding == null) { + padding = new Rect(); + sThreadLocal.set(padding); + } + mBackground.getPadding(padding); + mUserPaddingLeftInitial = padding.left; + mUserPaddingRightInitial = padding.right; + } switch (resolvedLayoutDirection) { case LAYOUT_DIRECTION_RTL: if (mUserPaddingStart != UNDEFINED_PADDING) { @@ -15338,6 +15352,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mUserPaddingRightInitial = padding.right; internalSetPadding(padding.left, padding.top, padding.right, padding.bottom); } + mUseBackgroundPadding = true; + } else { + mUseBackgroundPadding = false; } // Compare the minimum sizes of the old Drawable and the new. If there isn't an old or @@ -15363,6 +15380,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /* Remove the background */ mBackground = null; + mUseBackgroundPadding = false; + if ((mPrivateFlags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0) { /* * This view ONLY drew the background before and we're removing @@ -15434,6 +15453,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mUserPaddingLeftInitial = left; mUserPaddingRightInitial = right; + mUseBackgroundPadding = false; + internalSetPadding(left, top, right, bottom); } @@ -15520,6 +15541,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mUserPaddingStart = start; mUserPaddingEnd = end; + mUseBackgroundPadding = false; + switch(getLayoutDirection()) { case LAYOUT_DIRECTION_RTL: mUserPaddingLeftInitial = end; |
