Merge "Revert partial RTL'ization of Editor.setError()" into jb-mr1-dev

This commit is contained in:
Raph Levien
2012-11-02 15:05:07 -07:00
committed by Android (Google) Code Review

View File

@@ -144,7 +144,6 @@ public class Editor {
CharSequence mError;
boolean mErrorWasChanged;
ErrorPopup mErrorPopup;
private int mLastLayoutDirection = -1;
/**
* This flag is set if the TextView tries to display an error before it
@@ -290,29 +289,12 @@ public class Editor {
public void setError(CharSequence error, Drawable icon) {
mError = TextUtils.stringOrSpannedString(error);
mErrorWasChanged = true;
final int layoutDirection = mTextView.getLayoutDirection();
if (mLastLayoutDirection != layoutDirection) {
final Drawables dr = mTextView.mDrawables;
switch (layoutDirection) {
default:
case View.LAYOUT_DIRECTION_LTR:
if (dr != null) {
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
dr.mDrawableBottom);
} else {
mTextView.setCompoundDrawables(null, null, icon, null);
}
break;
case View.LAYOUT_DIRECTION_RTL:
if (dr != null) {
mTextView.setCompoundDrawables(icon, dr.mDrawableTop, dr.mDrawableRight,
dr.mDrawableBottom);
} else {
mTextView.setCompoundDrawables(icon, null, null, null);
}
break;
}
mLastLayoutDirection = layoutDirection;
final Drawables dr = mTextView.mDrawables;
if (dr != null) {
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
dr.mDrawableBottom);
} else {
mTextView.setCompoundDrawables(null, null, icon, null);
}
if (mError == null) {
if (mErrorPopup != null) {