-
Notifications
You must be signed in to change notification settings - Fork 384
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
Is it possible to paste into TokenCompleteTextView? #95
Comments
At the moment, pasting into the field will cause a disaster. I haven't handled any of the overrides to make paste work. I think the only thing that would need handling would be |
Thanks for the quick response. I'll play with it a bit and submit a pull request if I get it working. |
@banasiak Have you got paste (Single and multiple) email working? |
|
Update: Okay, so simply enabling long-press on This brings me to the question — why did you disable long-press in the first step? |
Update 2: Enabling cut / copy leads is breaking When a cut or copy action is received, it seems that Android re-inserts the spannable text within selection to the field, essentially making So even if you remove the token, one copy of that token will still be present in A probable solution is to add another check for duplicates inside I'll raise a PR with my changes. |
PR created: #197 :) |
The two reasons I disabled paste were that it was unreliable on some versions of Android (sadly I didn't keep notes on this) and that I could not figure out a good UX for what happens if you paste in multiple tokens. As you noted, getting this working is as simple as re-enabling long press. I'm happy to re-verify paste on all the supported Android versions, but I don't want to add this back into the main repo until we have a good consistent experience for pasting multiple tokens. |
You can let the subclass handle the pasted text when multiple tokens are pasted. I've added this to my fork of your library and it works pretty well. |
Sure, but that doesn't mean paste should be on by default. I'm happy to merge the prevent duplicates changes from you PR, but enabling long press should not be the default behavior. It should be possible to override this in your subclass. |
Sounds good. I can improve that PR by letting the subclass handle what to do with the pasted tokens. The currently open PR handles this in a dumb way by simply pasting the entire content into the field. |
please cherry-pick 6317aee for now, that would be helpful because that behavior easily be added in a subclass |
this leads to some problems if more than one token is actually parsed. however, for the common use case of parsing a single address, it seems to work just fine, so this hopefully does more good than harm. see also splitwise/TokenAutoComplete#95
I see that the TokenCompleteTextView is calling setLongClickable(false). Changing that to true causes all kinds of havoc when selecting a token. Do you have any ideas how I could paste into this text view without those side effects? Thanks in advance!
The text was updated successfully, but these errors were encountered: