Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b9b41c1 authored by Romain Guy's avatar Romain Guy Committed by Android Git Automerger
Browse files

am 1b3b2544: Merge "Dismiss error icon on setError(null) [regression] Bug #7442935" into jb-mr1-dev

* commit '1b3b2544':
  Dismiss error icon on setError(null) [regression] Bug #7442935
parents e980adfd 1b3b2544
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -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,11 +298,22 @@ public class Editor {

                mErrorPopup = null;
            }
        } else {
            if (mTextView.isFocused()) {

            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 {
            mTextView.setCompoundDrawables(null, null, icon, null);
        }
    }

    private void hideError() {
@@ -316,6 +321,8 @@ public class Editor {
            if (mErrorPopup.isShowing()) {
                mErrorPopup.dismiss();
            }

            setErrorIcon(null);
        }

        mShowErrorAfterAttach = false;