Skip to content

Commit d513e97

Browse files
author
Gilles Debunne
committed
Bug 5319091: Completions delayed in AutoComplete in landscape
The filtering is an async process. We need to re-update completion when it is finished. Changed loogic to mimic the way it was done in GB. Change-Id: If49048d786b3b9529da55c7247e7ef5f3d0fc8b5
1 parent b5dfcb8 commit d513e97

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

core/java/android/widget/AutoCompleteTextView.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package android.widget;
1818

19-
import com.android.internal.R;
20-
2119
import android.content.Context;
2220
import android.content.res.TypedArray;
2321
import android.database.DataSetObserver;
@@ -38,6 +36,8 @@
3836
import android.view.inputmethod.EditorInfo;
3937
import 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

Comments
 (0)