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

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

Fix possible crash in AutoCompleteTextView.

This change makes sure that ACTV will not take action when an event is
received in a popup that just got dismissed.

This change also makes public two XML attributes of ACTV whose corresponding
Java APIs are public.

This change also fixes a couple of typos.

Change-Id: I78f113bc522d199ff3db44fc4cc3a1882afe822e
parent 86aece8b
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -3144,6 +3144,17 @@
 visibility="public"
>
</field>
<field name="dropDownHorizontalOffset"
 type="int"
 transient="false"
 volatile="false"
 value="16843436"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="dropDownItemStyle"
 type="int"
 transient="false"
@@ -3177,6 +3188,17 @@
 visibility="public"
>
</field>
<field name="dropDownVerticalOffset"
 type="int"
 transient="false"
 volatile="false"
 value="16843437"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="dropDownWidth"
 type="int"
 transient="false"
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import android.annotation.SdkConstant;
 * to retrieve the folder's content.</p>
 *
 * <h3>Setting up the live folder activity</h3>
 * <p>The following code sample shows how to write an activity that creates a live fodler:</p>
 * <p>The following code sample shows how to write an activity that creates a live folder:</p>
 * <pre>
 * public static class MyLiveFolder extends Activity {
 *     public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");
+8 −5
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ import com.android.internal.R;
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownAnchor
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownWidth
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownVerticalOffset
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownHorizontalOffset
 */
public class AutoCompleteTextView extends EditText implements Filter.FilterListener {
    static final boolean DEBUG = false;
@@ -1153,7 +1155,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
                heightSpec = mDropDownHeight;
            }

            mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
            mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);

            mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset,
                    mDropDownVerticalOffset, widthSpec, heightSpec);
@@ -1183,8 +1185,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
            
            // use outside touchable to dismiss drop down when touching outside of it, so
            // only set this if the dropdown is not always visible
            mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
            mPopup.setTouchInterceptor(new PopupTouchIntercepter());
            mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
            mPopup.setTouchInterceptor(new PopupTouchInterceptor());
            mPopup.showAsDropDown(getDropDownAnchorView(),
                    mDropDownHorizontalOffset, mDropDownVerticalOffset);
            mDropDownList.setSelection(ListView.INVALID_POSITION);
@@ -1408,9 +1410,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
        }
    }

    private class PopupTouchIntercepter implements OnTouchListener {
    private class PopupTouchInterceptor implements OnTouchListener {
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
            if (event.getAction() == MotionEvent.ACTION_DOWN &&
                    mPopup != null && mPopup.isShowing()) {
                mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
                showDropDown();
            }
+2 −0
Original line number Diff line number Diff line
@@ -1176,6 +1176,8 @@
  <public type="attr" name="scrollbarDefaultDelayBeforeFade" />
  <public type="attr" name="fadeScrollbars" />
  <public type="attr" name="colorBackgroundCacheHint" />
  <public type="attr" name="dropDownHorizontalOffset" />
  <public type="attr" name="dropDownVerticalOffset" />
  
  <public type="style" name="Theme.Wallpaper" />
  <public type="style" name="Theme.Wallpaper.NoTitleBar" />