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

Commit c27cc01f authored by Romain Guy's avatar Romain Guy
Browse files

Prevent AutoCompleteTextView from opening a popup when it shouldn't

Bug #5553515

The People app is forcing ACTV to show the IME which had the side effect
of showing the drop down popup. ACTV was unfortunately not ready to show
the drop down if the filtering resulted in no results. Doing so was putting
ACTV in a weird state that in turn caused a window to be leaked and really
bad behavior to occur in the lower graphics levels.

Change-Id: I2ff146d5ae4e4a28edf6ea17039c9f8fdb710e4f
parent fe455af2
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1031,8 +1031,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
    public void ensureImeVisible(boolean visible) {
    public void ensureImeVisible(boolean visible) {
        mPopup.setInputMethodMode(visible
        mPopup.setInputMethodMode(visible
                ? ListPopupWindow.INPUT_METHOD_NEEDED : ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
                ? ListPopupWindow.INPUT_METHOD_NEEDED : ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
        if (mPopup.isDropDownAlwaysVisible() || (mFilter != null && enoughToFilter())) {
            showDropDown();
            showDropDown();
        }
        }
    }


    /**
    /**
     * @hide internal used only here and SearchDialog
     * @hide internal used only here and SearchDialog
+9 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Bundle;
import android.text.TextPaint;
import android.view.View;
import android.view.View;


@SuppressWarnings({"UnusedDeclaration"})
@SuppressWarnings({"UnusedDeclaration"})
@@ -39,6 +40,7 @@ public class TextActivity extends Activity {
        private final Paint mScaledPaint;
        private final Paint mScaledPaint;
        private final Paint mSkewPaint;
        private final Paint mSkewPaint;
        private final Paint mHugePaint;
        private final Paint mHugePaint;
        private final TextPaint mEventPaint;


        CustomTextView(Context c) {
        CustomTextView(Context c) {
            super(c);
            super(c);
@@ -70,6 +72,11 @@ public class TextActivity extends Activity {
            mHugePaint.setAntiAlias(true);
            mHugePaint.setAntiAlias(true);
            mHugePaint.setColor(0xff000000);
            mHugePaint.setColor(0xff000000);
            mHugePaint.setTextSize(300f);
            mHugePaint.setTextSize(300f);

            mEventPaint = new TextPaint();
            mEventPaint.setFakeBoldText(true);
            mEventPaint.setAntiAlias(true);
            mEventPaint.setTextSize(14);
        }
        }


        @Override
        @Override
@@ -77,6 +84,8 @@ public class TextActivity extends Activity {
            super.onDraw(canvas);
            super.onDraw(canvas);
            canvas.drawRGB(255, 255, 255);
            canvas.drawRGB(255, 255, 255);


            canvas.drawText("Hello OpenGL renderer!", 300, 20, mEventPaint);
            
            mMediumPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            mMediumPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            mMediumPaint.setStrokeWidth(2.0f);
            mMediumPaint.setStrokeWidth(2.0f);
            canvas.drawText("Hello OpenGL renderer!", 100, 20, mMediumPaint);
            canvas.drawText("Hello OpenGL renderer!", 100, 20, mMediumPaint);