summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2012-11-06 16:15:26 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2012-11-06 16:15:27 -0800
commit1b3b2544e647a40094b9c9df2c94e34df7921da5 (patch)
treefed0d04099f22a3e4705a5dd4289849408cb1692
parent4a1b6e42424d08da0d22a24464e568034ea557ee (diff)
parentd1cc1878cc7a07c794feec51c840fd566f59d523 (diff)
Merge "Dismiss error icon on setError(null) [regression] Bug #7442935" into jb-mr1-dev
-rw-r--r--core/java/android/widget/Editor.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 5397eb6634fa..b1a44c5a89bc 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -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;