diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2013-08-09 19:54:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-09 19:54:19 +0000 |
commit | 88dced29361c463299e55f059c9d4a7610116ef6 (patch) | |
tree | 9ffb920b01213dabd70d1b4fd30804803d2ded8d /core | |
parent | d81a15c6b77c94109d0a08bc7355f62301fe9234 (diff) | |
parent | 4155e2e175d73bb98b13ecb2fbbe6a6dffe28fe5 (diff) | |
download | frameworks_base-88dced29361c463299e55f059c9d4a7610116ef6.zip frameworks_base-88dced29361c463299e55f059c9d4a7610116ef6.tar.gz frameworks_base-88dced29361c463299e55f059c9d4a7610116ef6.tar.bz2 |
Merge "Fix bug #10210182 CTS: android.widget.cts.TextViewTest#testDrawableResolution is failing on KLP" into klp-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/View.java | 25 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 20938f5..019d871 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14659,13 +14659,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ protected void resolveDrawables() { - if (canResolveLayoutDirection()) { - if (mBackground != null) { - mBackground.setLayoutDirection(getLayoutDirection()); - } - mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; - onResolveDrawables(getLayoutDirection()); + // Drawables resolution may need to happen before resolving the layout direction (which is + // done only during the measure() call). + // If the layout direction is not resolved yet, we cannot resolve the Drawables except in + // one case: when the raw layout direction has not been defined as LAYOUT_DIRECTION_INHERIT. + // So, if the raw layout direction is LAYOUT_DIRECTION_LTR or LAYOUT_DIRECTION_RTL or + // LAYOUT_DIRECTION_LOCALE, we can "cheat" and we don't need to wait for the layout + // direction to be resolved as its resolved value will be the same as its raw value. + if (!isLayoutDirectionResolved() && + getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT) { + return; + } + + final int layoutDirection = isLayoutDirectionResolved() ? + getLayoutDirection() : getRawLayoutDirection(); + + if (mBackground != null) { + mBackground.setLayoutDirection(layoutDirection); } + mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; + onResolveDrawables(layoutDirection); } /** diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 3181164..9c21f0d 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -1378,6 +1378,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } else { dr.mDrawableSizeEnd = dr.mDrawableHeightEnd = 0; } + resetResolvedDrawables(); + resolveDrawables(); } } |