splitwise / TokenAutoComplete

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

Suggested Token Added When Losing Focus #374

Closed AEFeinstein closed 5 years ago

AEFeinstein commented 5 years ago

I'm using 3.0.0-alpha2.

I have a TokenCompleteTextView with an ArrayAdapter for suggestions. Whenever the TokenCompleteTextView loses focus, a token is added with the first suggestion. This happens even if there is no text typed in. This token should not be automatically added. If there is non-token text, the first suggestion token will be added after the non-token text. If there are tokens already, another one will be added.

This seems to be new in 3.x.x. 2.0.8 did not exhibit this behavior. I can't replicate this in the example app, but you can see it in mine in the fields labeled "(Super)Type" and "Subtype": https://github.com/AEFeinstein/mtg-familiar/releases/tag/v3.5.6

mgod commented 5 years ago

It looks like the new text handling is having some trouble with how you're overriding enoughToFilter. In ATokenTextView, try:

    @Override
    public boolean enoughToFilter() {
        return isFocused();
    }

I'm expecting to disable to completion on focus loss behavior when I have the time, but this should resolve it for now.

AEFeinstein commented 5 years ago

Yep, that resolves it for now. Thank you as always!