splitwise / TokenAutoComplete

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

Disable adding token without pressing dropdown #363

Closed dragossusi closed 5 years ago

dragossusi commented 5 years ago

I am populating the adapter using retrofit with observables. I want to prevent adding tokens that are not in the adapter's list. Is it possible?

mgod commented 5 years ago

You should return null from defaultObject and leave performBestGuess to its default value of true.

dragossusi commented 5 years ago

Actually i want to disable bestquess too. I found a workaround overriding performCompletion

    override fun performCompletion() {
        if ((getAdapter() == null || getListSelection() == ListView.INVALID_POSITION) && enoughToFilter()) {
            //avoid adding
        } else super.performCompletion()
    }