1616
1717package android .widget ;
1818
19- import com .android .internal .R ;
20-
2119import android .content .Context ;
2220import android .content .res .TypedArray ;
2321import android .database .DataSetObserver ;
3836import android .view .inputmethod .EditorInfo ;
3937import android .view .inputmethod .InputMethodManager ;
4038
39+ import com .android .internal .R ;
40+
4141
4242/**
4343 * <p>An editable text view that shows completion suggestions automatically
@@ -744,7 +744,6 @@ void doAfterTextChanged() {
744744 if (mFilter != null ) {
745745 mPopupCanBeUpdated = true ;
746746 performFiltering (getText (), mLastKeyCode );
747- buildImeCompletions ();
748747 }
749748 } else {
750749 // drop down is automatically dismissed when enough characters
@@ -938,7 +937,8 @@ private void updateDropDownForFilter(int count) {
938937 */
939938
940939 final boolean dropDownAlwaysVisible = mPopup .isDropDownAlwaysVisible ();
941- if ((count > 0 || dropDownAlwaysVisible ) && enoughToFilter ()) {
940+ final boolean enoughToFilter = enoughToFilter ();
941+ if ((count > 0 || dropDownAlwaysVisible ) && enoughToFilter ) {
942942 if (hasFocus () && hasWindowFocus () && mPopupCanBeUpdated ) {
943943 showDropDown ();
944944 }
@@ -1049,6 +1049,8 @@ public boolean isInputMethodNotNeeded() {
10491049 * <p>Displays the drop down on screen.</p>
10501050 */
10511051 public void showDropDown () {
1052+ buildImeCompletions ();
1053+
10521054 if (mPopup .getAnchorView () == null ) {
10531055 if (mDropDownAnchorId != View .NO_ID ) {
10541056 mPopup .setAnchorView (getRootView ().findViewById (mDropDownAnchorId ));
@@ -1064,7 +1066,7 @@ public void showDropDown() {
10641066 mPopup .show ();
10651067 mPopup .getListView ().setOverScrollMode (View .OVER_SCROLL_ALWAYS );
10661068 }
1067-
1069+
10681070 /**
10691071 * Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is
10701072 * false, we allow outside touch to dismiss the dropdown. If this is set to true, then we
@@ -1075,7 +1077,7 @@ public void showDropDown() {
10751077 public void setForceIgnoreOutsideTouch (boolean forceIgnoreOutsideTouch ) {
10761078 mPopup .setForceIgnoreOutsideTouch (forceIgnoreOutsideTouch );
10771079 }
1078-
1080+
10791081 private void buildImeCompletions () {
10801082 final ListAdapter adapter = mAdapter ;
10811083 if (adapter != null ) {
@@ -1090,8 +1092,7 @@ private void buildImeCompletions() {
10901092 realCount ++;
10911093 Object item = adapter .getItem (i );
10921094 long id = adapter .getItemId (i );
1093- completions [i ] = new CompletionInfo (id , i ,
1094- convertSelectionToString (item ));
1095+ completions [i ] = new CompletionInfo (id , i , convertSelectionToString (item ));
10951096 }
10961097 }
10971098
0 commit comments