Skip to content

Commit

Permalink
[TextField] Link OnItemSelectedListener of AutoCompleteTextView with …
Browse files Browse the repository at this point in the history
…the actual drop-down list

Framework has no default implementation of how or when OnItemSelectedListener will be called. We need to link it with the actual ListPopupWindow we are going to show.

Resolves #1804

PiperOrigin-RevId: 449725174
  • Loading branch information
drchen authored and afohrman committed May 19, 2022
1 parent 73cb1b6 commit 2db8b0c
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -41,6 +41,7 @@
import android.view.accessibility.AccessibilityManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Filterable;
import android.widget.ListAdapter;
Expand Down Expand Up @@ -192,6 +193,12 @@ public void setRawInputType(int type) {
onInputTypeChanged();
}

@Override
public void setOnItemSelectedListener(@Nullable OnItemSelectedListener listener) {
super.setOnItemSelectedListener(listener);
modalListPopup.setOnItemSelectedListener(getOnItemSelectedListener());
}

/**
* Sets the simple string items of auto-completion with the given string array resource. This
* method will create a default {@link ArrayAdapter} with a default item layout specified by
Expand Down

0 comments on commit 2db8b0c

Please sign in to comment.