Skip to content

Duplicate tokens after collapse and re-expand #218

Description

@sperls

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

Activity

  1. mgod commented on May 12, 2016

    @mgod
    Contributor

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

  2. sperls commented on May 12, 2016

    @sperls
    Author

    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) { }
        });
    
  3. mgod commented on May 12, 2016

    @mgod
    Contributor

    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.

  4. mgod commented on Mar 9, 2019

    @mgod
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions