Skip to content

Commit 1b3b254

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Dismiss error icon on setError(null) [regression] Bug #7442935" into jb-mr1-dev
2 parents 4a1b6e4 + d1cc187 commit 1b3b254

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

core/java/android/widget/Editor.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,7 @@ private void showError() {
289289
public void setError(CharSequence error, Drawable icon) {
290290
mError = TextUtils.stringOrSpannedString(error);
291291
mErrorWasChanged = true;
292-
final Drawables dr = mTextView.mDrawables;
293-
if (dr != null) {
294-
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
295-
dr.mDrawableBottom);
296-
} else {
297-
mTextView.setCompoundDrawables(null, null, icon, null);
298-
}
292+
299293
if (mError == null) {
300294
if (mErrorPopup != null) {
301295
if (mErrorPopup.isShowing()) {
@@ -304,10 +298,21 @@ public void setError(CharSequence error, Drawable icon) {
304298

305299
mErrorPopup = null;
306300
}
301+
302+
setErrorIcon(null);
303+
} else if (mTextView.isFocused()) {
304+
showError();
305+
setErrorIcon(icon);
306+
}
307+
}
308+
309+
private void setErrorIcon(Drawable icon) {
310+
final Drawables dr = mTextView.mDrawables;
311+
if (dr != null) {
312+
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
313+
dr.mDrawableBottom);
307314
} else {
308-
if (mTextView.isFocused()) {
309-
showError();
310-
}
315+
mTextView.setCompoundDrawables(null, null, icon, null);
311316
}
312317
}
313318

@@ -316,6 +321,8 @@ private void hideError() {
316321
if (mErrorPopup.isShowing()) {
317322
mErrorPopup.dismiss();
318323
}
324+
325+
setErrorIcon(null);
319326
}
320327

321328
mShowErrorAfterAttach = false;

0 commit comments

Comments
 (0)