Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With getThreshold() set to 0, default object is added when view loses focus #94

Closed
vit001 opened this issue Jan 15, 2015 · 4 comments
Closed

Comments

@vit001
Copy link

vit001 commented Jan 15, 2015

I would like to use a threshold of 0 in my app - a list of available tokens is always shown. However, since internally a space is added after every token, upon loss of focus the default object will be appended at the end. The sample app exhibits this behavior when the following is added to ContactsCompletionView:

@OverRide
public int getThreshold() {
return 0;
}

I think the solution is to modify enoughToFilter() to return false when getThreshold()==0;

@mgod
Copy link
Contributor

mgod commented Jan 16, 2015

hmmmm, modifying enoughToFilter like that would be a pain. How would you feel about requiring at least 2 characters for the focus loss completion to work? I haven't really found a solution for this that I like.

@vit001
Copy link
Author

vit001 commented Jan 17, 2015

I am not sure I understand why modifying enoughToFilter is a bad idea. I was thinking of this:

return end - start >= getThreshold()  &&  getThreshold() > 0

I think requiring 2 characters for focus loss completion works too....

@mgod
Copy link
Contributor

mgod commented Jan 17, 2015

enoughToFilter also gets used when the user hits done on the keyboard or types the split character, so making it permanently false for threshold 0 would disable them. I think I would be tempted to add a check in enough to filter to make sure end-start >= 1 && end - start > getThreshold() and see how that works

@wdullaer
Copy link
Contributor

If you do not enable best guesses, the library tries to add an object with an empty string representation.
I am specifically testing for that to get rid of this behaviour.
As a workaround you can try to ensure that the best guess for no input returns an object with an empty string representation "".equals(defaultObject.toString()) == true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants