Dismiss error icon on setError(null) [regression]

Bug #7442935

Change-Id: I783d868173637007be326e20795cbb4cb8c7b899
This commit is contained in:
Romain Guy
2012-11-05 17:43:25 -08:00
parent e6299d5af7
commit d1cc1878cc

View File

@ -289,13 +289,7 @@ public class Editor {
public void setError(CharSequence error, Drawable icon) {
mError = TextUtils.stringOrSpannedString(error);
mErrorWasChanged = true;
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) {
if (mErrorPopup.isShowing()) {
@ -304,10 +298,21 @@ public class Editor {
mErrorPopup = null;
}
setErrorIcon(null);
} else if (mTextView.isFocused()) {
showError();
setErrorIcon(icon);
}
}
private void setErrorIcon(Drawable icon) {
final Drawables dr = mTextView.mDrawables;
if (dr != null) {
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
dr.mDrawableBottom);
} else {
if (mTextView.isFocused()) {
showError();
}
mTextView.setCompoundDrawables(null, null, icon, null);
}
}
@ -316,6 +321,8 @@ public class Editor {
if (mErrorPopup.isShowing()) {
mErrorPopup.dismiss();
}
setErrorIcon(null);
}
mShowErrorAfterAttach = false;