splitwise / TokenAutoComplete

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

Display first token "+count" #425

Closed IgnacioGarcia198 closed 2 years ago

IgnacioGarcia198 commented 2 years ago

Hello,

first of all thanks for your great work with this library.

This is a feature request / question if feature is already there.

I have a problem that happens when view collapses and first token is wider than the view, I would like to shorten the first token's display name in order to always display it ellipsized, in the way: first token... +3 but what is happening is that, when the text in the first token is longer than the allowed width, method performCollapse just hides the whole token and I just get "+count". In current example: +3

I managed to find a workaround for this, but only worked in versions before 3.x. I am currently using version 2.0.7, the workaround is working, but I get the problem that the spacing between first and second line is greater than the spacing between the rest of the lines. This spacing problem is fixed on 3.x onwards and that is why I would like to update to such version.

Getting just "+count", is this by design? Is there any known way or workaround to get this done? Thanks in advance.

mgod commented 2 years ago

I don't know about a workaround for this. There's nothing in the library intended to allow you to adjust the size of the tokens during performCollapse, so getting just + count is correct if the tokens are too large.

IgnacioGarcia198 commented 2 years ago

Thanks for your reply. And is there any way to fix the problem of the different spacing between lines on version 2.0.7? that the spacing between first and second line is greater than the spacing between the rest of the lines. My workaround for the + count issue is working in that version, but I get this issue of different spacing. Thanks in advance.

mgod commented 2 years ago

You could maybe pull over the relevant code from here into a custom ViewSpan class: https://github.com/splitwise/TokenAutoComplete/commit/07ee5e0c02f68d4cecf2920aa558ee7e89fdcdab

I'm not sure if there are any v3 specific changes this depends on.