rajsuvariya / autocompletetextview

2 stars 5 forks source link

When showDialog should performFiltering #16

Open Noitidart opened 6 years ago

Noitidart commented 6 years ago

If we just showDialog, it doesn't filter the list based on the text. So we have to do this:

            MyAutoCompleteTextView v = (MyAutoCompleteTextView) view;
                v.showDropDown();
                CharSequence text = v.getText();
                v.performFiltering(text, 0);

However this giving me the following error:

C:\Users\Mercurius\Documents\GitHub\autocomplete\node_modules\autocompletetextview\android\src\main\java\com\reactlibrary\AutoCompleteTextViewManager.java:52: error: performFiltering(CharSequence,int) has protected access in AutoCompleteTextView
                    v.performFiltering(text, 0);

Any ideas on how to fix this?

Noitidart commented 6 years ago

We can instead do v.setText(v.getText(), true); which will cause the filtering to happen, however it moves the cursor position :(

Noitidart commented 6 years ago

Maybe this isn't the case. I think we should not force this behavior when 0. Why did you decide for a showDialog onFocus and onClick? What do you think about removing this and just letting the component handle when to show the dialog?