-
Notifications
You must be signed in to change notification settings - Fork 383
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
Limit the number of character in Token (or add "...") #179
Comments
The duplication is definitely a bug. To avoid the extra long token, you just need to return a view from |
I don't think doing a lot of work on the layout is going to do a much better job than just picking a reasonable token size maximum. If we ware going to do fully justified tokens, we'd also need to be able to expand them as well. If we're not, I'm not sure the result would be much better than if you set you max width to about 1/3 of the available space of the field. |
More helpful note is that you can probably do this yourself if you want. In your subclass of |
I could see adding a call that would give the amount of space left for tokens on the current line, which would make custom token sizing relatively straightforward. I just don't think adding a bunch of custom layout finagling code to an already tricky library is going to give good results. |
I take everything back, this might be very simple. |
can you take a look at https://github.com/splitwise/TokenAutoComplete/tree/width-experiment and let me know if it works for you? |
The only file that has been changed is link to File |
I'm terribly sorry, I failed to actually push the changes. You should see more changed now. This doesn't fix the duplicate issue, but does let you do custom handling for the width of tokens by overriding protected float maxTokenWidth() {
float left = getTextLineWidthLeft();
if (left < maxTextWidth() / 4) {
return maxTextWidth();
} else {
return left;
}
} |
to be completely honest I do not get how this can help me ! so if you help me out a little more, I can check what ever you want :) |
Ah, I see. Sorry to misunderstand. I think live resizing and auto layout of the tokens on field resize is possible, and the code I've added in that branch is the start of it. I don't think this is something I'll be able to get in a comfortable place to add to the main library. |
No problem, and again thanks for your nice work. back to the duplication bug, can I have an ETA on it, please? |
Unfortunately, It's not something I can see a simple fix to, so I'm not sure when I'll get it done. |
Version |
Hi,
great work on the library, Thanks !
here is a bug_report / request,
when the token's width is longer than the MultiAutoCompleteTextView's width, somehow the token gets cropped (Which is not a bad thing!) and then it gets duplicated in two lines.
so either let me know how I can prevent the duplication, or how we can replace the string in the token with string.substring(0,LIMIT) + "..." or any other enhancement
in the first screenshot you can see both TAC s showing the tokens OK!
here the right one increased in size, hence the left one gets smaller than the token (ONLY ONE TOKEN, IT HAS) and you can see how it gets duplicated
same goes with the left one here
The text was updated successfully, but these errors were encountered: