splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 383 forks source link

Dropdown list is not reset when setThredshold(0) #411

Open jasontruong opened 3 years ago

jasontruong commented 3 years ago

This can be reproduce by ExampleActivity:

  1. Set Thredshold(0) in completionView
  2. In email completeView, type "ma". Dropdown list will appear, then select the first item. The dropdown will be dismissed
  3. Click on the completionView again. The dropdown is appeared as if filtered by "ma", although user didn't type anything. The only way to reset full dropdown list is type some random character, then delete it.

If you know any way to walk around this. Please advise :) Thank you

jasontruong commented 3 years ago

Oh, you may need to add completionView.showDropDown in onClickListener() for dropdown to show when onClick

mgod commented 3 years ago

Yes, this is correct. Threshold of 0 is ignored and supposed to be set to 1 (see https://developer.android.com/reference/android/widget/AutoCompleteTextView#setThreshold(int)). It sounds like I may have missed a spot that needs to pay attention to this.

I think you should be able to work around this by calling performFiltering("", 0) in your subclass or calling adapter.getFilter().filter("") on your adapter, which should reset the list.

jasontruong commented 3 years ago

Thank you very much! I was not aware this is by design from AutoCompleteTextView. :O :O