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

Commit a85467bc authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Error popup no longer flickers in TextViews.

The removed lines were committed by the Android Open Source Project.
Their intent was probably: the message was there before, it is identical
after a text change, let's remove it to not annoy the user who already saw it.

The behavior however is that the message is displayed then hidden, then displayed
as the user types.

Bug 3365016

Change-Id: Ie820f8e5465ad8ab5890272c42627686e0d7961b
parent baf9af94
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -3426,8 +3426,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            setError(null, null);
        } else {
            Drawable dr = getContext().getResources().
                getDrawable(com.android.internal.R.drawable.
                            indicator_input_error);
                getDrawable(com.android.internal.R.drawable.indicator_input_error);

            dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight());
            setError(error, dr);
@@ -3450,8 +3449,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        mErrorWasChanged = true;
        final Drawables dr = mDrawables;
        if (dr != null) {
            setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop,
                                 icon, dr.mDrawableBottom);
            setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon, dr.mDrawableBottom);
        } else {
            setCompoundDrawables(null, null, icon, null);
        }
@@ -3479,8 +3477,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        if (mPopup == null) {
            LayoutInflater inflater = LayoutInflater.from(getContext());
            final TextView err = (TextView) inflater.inflate(com.android.internal.R.layout.textview_hint,
                    null);
            final TextView err = (TextView) inflater.inflate(
                    com.android.internal.R.layout.textview_hint, null);

            final float scale = getResources().getDisplayMetrics().density;
            mPopup = new ErrorPopup(err, (int) (200 * scale + 0.5f),
+0 −4
Original line number Diff line number Diff line
@@ -142,10 +142,6 @@ public class EditableInputConnection extends BaseInputConnection {
        boolean success = super.commitText(text, newCursorPosition);
        CharSequence errorAfter = mTextView.getError();

        if (errorAfter != null && errorBefore == errorAfter) {
            mTextView.setError(null, null);
        }

        return success;
    }
}