Loading core/java/android/view/View.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -14217,12 +14217,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide * @hide */ */ protected void resolveDrawables() { protected void resolveDrawables() { if (canResolveLayoutDirection()) { if (mBackground != null) { if (mBackground != null) { mBackground.setLayoutDirection(getLayoutDirection()); mBackground.setLayoutDirection(getLayoutDirection()); } } mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; onResolveDrawables(getLayoutDirection()); onResolveDrawables(getLayoutDirection()); } } } /** /** * Called when layout direction has been resolved. * Called when layout direction has been resolved. core/java/android/view/ViewGroup.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -3478,7 +3478,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (child.isLayoutDirectionInherited()) { if (child.isLayoutDirectionInherited()) { child.resetRtlProperties(); child.resetRtlProperties(); child.resolveRtlPropertiesIfNeeded(); } } onViewAdded(child); onViewAdded(child); Loading core/java/android/widget/Editor.java +19 −10 Original line number Original line Diff line number Diff line Loading @@ -144,6 +144,8 @@ public class Editor { CharSequence mError; CharSequence mError; boolean mErrorWasChanged; boolean mErrorWasChanged; ErrorPopup mErrorPopup; ErrorPopup mErrorPopup; private int mLastLayoutDirection = -1; /** /** * This flag is set if the TextView tries to display an error before it * This flag is set if the TextView tries to display an error before it * is attached to the window (so its position is still unknown). * is attached to the window (so its position is still unknown). Loading Loading @@ -288,23 +290,30 @@ public class Editor { public void setError(CharSequence error, Drawable icon) { public void setError(CharSequence error, Drawable icon) { mError = TextUtils.stringOrSpannedString(error); mError = TextUtils.stringOrSpannedString(error); mErrorWasChanged = true; mErrorWasChanged = true; final int layoutDirection = mTextView.getLayoutDirection(); if (mLastLayoutDirection != layoutDirection) { final Drawables dr = mTextView.mDrawables; final Drawables dr = mTextView.mDrawables; if (dr != null) { switch (layoutDirection) { switch (mTextView.getLayoutDirection()) { default: default: case View.LAYOUT_DIRECTION_LTR: case View.LAYOUT_DIRECTION_LTR: if (dr != null) { mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, dr.mDrawableBottom); dr.mDrawableBottom); } else { mTextView.setCompoundDrawables(null, null, icon, null); } break; break; case View.LAYOUT_DIRECTION_RTL: case View.LAYOUT_DIRECTION_RTL: if (dr != null) { mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight, mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom); dr.mDrawableBottom); } else { mTextView.setCompoundDrawables(icon, null, null, null); } break; break; } } } else { mLastLayoutDirection = layoutDirection; mTextView.setCompoundDrawables(null, null, icon, null); } } if (mError == null) { if (mError == null) { if (mErrorPopup != null) { if (mErrorPopup != null) { if (mErrorPopup.isShowing()) { if (mErrorPopup.isShowing()) { Loading core/java/android/widget/TextView.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -307,7 +307,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private Layout.Alignment mLayoutAlignment; private Layout.Alignment mLayoutAlignment; private int mResolvedTextAlignment; private int mResolvedTextAlignment; private boolean mResolvedDrawables; private int mLastLayoutDirection = -1; /** /** * On some devices the fading edges add a performance penalty if used * On some devices the fading edges add a performance penalty if used Loading Loading @@ -8257,16 +8257,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override @Override public void onResolveDrawables(int layoutDirection) { public void onResolveDrawables(int layoutDirection) { // No need to resolve twice // No need to resolve twice if (mResolvedDrawables) { if (mLastLayoutDirection == layoutDirection) { return; return; } } mLastLayoutDirection = layoutDirection; // No drawable to resolve // No drawable to resolve if (mDrawables == null) { if (mDrawables == null) { return; return; } } // No relative drawable to resolve // No relative drawable to resolve if (mDrawables.mDrawableStart == null && mDrawables.mDrawableEnd == null) { if (mDrawables.mDrawableStart == null && mDrawables.mDrawableEnd == null) { mResolvedDrawables = true; return; return; } } Loading Loading @@ -8304,7 +8304,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; break; } } updateDrawablesLayoutDirection(dr, layoutDirection); updateDrawablesLayoutDirection(dr, layoutDirection); mResolvedDrawables = true; } } private void updateDrawablesLayoutDirection(Drawables dr, int layoutDirection) { private void updateDrawablesLayoutDirection(Drawables dr, int layoutDirection) { Loading @@ -8326,7 +8325,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @hide * @hide */ */ protected void resetResolvedDrawables() { protected void resetResolvedDrawables() { mResolvedDrawables = false; mLastLayoutDirection = -1; } } /** /** Loading Loading
core/java/android/view/View.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -14217,12 +14217,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide * @hide */ */ protected void resolveDrawables() { protected void resolveDrawables() { if (canResolveLayoutDirection()) { if (mBackground != null) { if (mBackground != null) { mBackground.setLayoutDirection(getLayoutDirection()); mBackground.setLayoutDirection(getLayoutDirection()); } } mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED; onResolveDrawables(getLayoutDirection()); onResolveDrawables(getLayoutDirection()); } } } /** /** * Called when layout direction has been resolved. * Called when layout direction has been resolved.
core/java/android/view/ViewGroup.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -3478,7 +3478,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (child.isLayoutDirectionInherited()) { if (child.isLayoutDirectionInherited()) { child.resetRtlProperties(); child.resetRtlProperties(); child.resolveRtlPropertiesIfNeeded(); } } onViewAdded(child); onViewAdded(child); Loading
core/java/android/widget/Editor.java +19 −10 Original line number Original line Diff line number Diff line Loading @@ -144,6 +144,8 @@ public class Editor { CharSequence mError; CharSequence mError; boolean mErrorWasChanged; boolean mErrorWasChanged; ErrorPopup mErrorPopup; ErrorPopup mErrorPopup; private int mLastLayoutDirection = -1; /** /** * This flag is set if the TextView tries to display an error before it * This flag is set if the TextView tries to display an error before it * is attached to the window (so its position is still unknown). * is attached to the window (so its position is still unknown). Loading Loading @@ -288,23 +290,30 @@ public class Editor { public void setError(CharSequence error, Drawable icon) { public void setError(CharSequence error, Drawable icon) { mError = TextUtils.stringOrSpannedString(error); mError = TextUtils.stringOrSpannedString(error); mErrorWasChanged = true; mErrorWasChanged = true; final int layoutDirection = mTextView.getLayoutDirection(); if (mLastLayoutDirection != layoutDirection) { final Drawables dr = mTextView.mDrawables; final Drawables dr = mTextView.mDrawables; if (dr != null) { switch (layoutDirection) { switch (mTextView.getLayoutDirection()) { default: default: case View.LAYOUT_DIRECTION_LTR: case View.LAYOUT_DIRECTION_LTR: if (dr != null) { mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, dr.mDrawableBottom); dr.mDrawableBottom); } else { mTextView.setCompoundDrawables(null, null, icon, null); } break; break; case View.LAYOUT_DIRECTION_RTL: case View.LAYOUT_DIRECTION_RTL: if (dr != null) { mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight, mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight, dr.mDrawableBottom); dr.mDrawableBottom); } else { mTextView.setCompoundDrawables(icon, null, null, null); } break; break; } } } else { mLastLayoutDirection = layoutDirection; mTextView.setCompoundDrawables(null, null, icon, null); } } if (mError == null) { if (mError == null) { if (mErrorPopup != null) { if (mErrorPopup != null) { if (mErrorPopup.isShowing()) { if (mErrorPopup.isShowing()) { Loading
core/java/android/widget/TextView.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -307,7 +307,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private Layout.Alignment mLayoutAlignment; private Layout.Alignment mLayoutAlignment; private int mResolvedTextAlignment; private int mResolvedTextAlignment; private boolean mResolvedDrawables; private int mLastLayoutDirection = -1; /** /** * On some devices the fading edges add a performance penalty if used * On some devices the fading edges add a performance penalty if used Loading Loading @@ -8257,16 +8257,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override @Override public void onResolveDrawables(int layoutDirection) { public void onResolveDrawables(int layoutDirection) { // No need to resolve twice // No need to resolve twice if (mResolvedDrawables) { if (mLastLayoutDirection == layoutDirection) { return; return; } } mLastLayoutDirection = layoutDirection; // No drawable to resolve // No drawable to resolve if (mDrawables == null) { if (mDrawables == null) { return; return; } } // No relative drawable to resolve // No relative drawable to resolve if (mDrawables.mDrawableStart == null && mDrawables.mDrawableEnd == null) { if (mDrawables.mDrawableStart == null && mDrawables.mDrawableEnd == null) { mResolvedDrawables = true; return; return; } } Loading Loading @@ -8304,7 +8304,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; break; } } updateDrawablesLayoutDirection(dr, layoutDirection); updateDrawablesLayoutDirection(dr, layoutDirection); mResolvedDrawables = true; } } private void updateDrawablesLayoutDirection(Drawables dr, int layoutDirection) { private void updateDrawablesLayoutDirection(Drawables dr, int layoutDirection) { Loading @@ -8326,7 +8325,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @hide * @hide */ */ protected void resetResolvedDrawables() { protected void resetResolvedDrawables() { mResolvedDrawables = false; mLastLayoutDirection = -1; } } /** /** Loading