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

Duplicate tokens after collapse and re-expand #218

Closed
sperls opened this issue May 12, 2016 · 4 comments
Closed

Duplicate tokens after collapse and re-expand #218

sperls opened this issue May 12, 2016 · 4 comments

Comments

@sperls
Copy link

sperls commented May 12, 2016

After entering enough tokens for the TokenAutoComplete to collapse, take focus away from it, then focus on it again so it expands. There are now duplicate tokens.

allowDuplicates set to false, and no duplicates entered initially.

Android 6.0.1
Nexus 6P
tokenautocomplete:2.0.7

@mgod
Copy link
Contributor

mgod commented May 12, 2016

I'm not able to reproduce this. In your example, are you using the example from this library or your own code?

@sperls
Copy link
Author

sperls commented May 12, 2016

My own code following the example quite closely. I am also doing my own filtering of a listview so that i can display the list in the main part of the fragment instead of the dropdown. Do I need to set my adapter to the TokenAutoComplete for the list collapse to function properly? If so, how would I prevent the suggestion pop-up from displaying?

This is how I am setting up my extended TokenAutoComplete:

(composeRecipientView is my TokenAutoComplete)

    composeRecipientView.allowDuplicates(false);
    composeRecipientView.setTokenClickStyle(TokenCompleteTextView.TokenClickStyle.Select);
    composeRecipientView.setDeletionStyle(TokenCompleteTextView.TokenDeleteStyle.Clear);

    composeRecipientView.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) { }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            searchString = s.toString().replaceAll(",","").replaceAll("\\s","");
            if(friendListAdapter != null) {
                friendListAdapter.getFilter().filter(searchString);
            }
        }

        @Override
        public void afterTextChanged(Editable s) { }
    });

@mgod
Copy link
Contributor

mgod commented May 12, 2016

I'm wondering if there's some specific configuration change you're making in your code that I'm not duplicating and that's why I can reproduce the issue. If you can reproduce the problem with a tweaked version of the example project, I should be able to recreate the issue.

You might try setting the adapter on the token view and set android:dropDownHeight="0px" in your token view XML, but I don't expect that to solve the issue. You'll probably also find currentCompletionText in the token view to be more useful than the string work you're doing to get your search term, though it is protected.

@mgod
Copy link
Contributor

mgod commented Mar 9, 2019

This was completely re-written for version 3.0.0 and I would expect this issue to be resolved. Please let me know if you're still having trouble after the update.

@mgod mgod closed this as completed Mar 9, 2019
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

2 participants