Skip to content

Multiple rows opened despite setMode(Attributes.Mode.Single); call #162

Open

Description

@bradroid

This bug can be reproduced in the demo application.
Steps to reproduce:

  1. Open AndroidSwipeLayout demo app
  2. Open RecyclerView demo
  3. Delete item number 6 (Colorado)
  4. Delete item number 6 (Connecticut)
  5. Delete item number 6 (Delaware)
  6. You are now able to open both California and Florida (items 5 and 6) at the same time, even thought Mode.Single is set. Also, this is possible only if you open Florida first 😕
    EDIT: Actually, the bugged items in this case are: Florida, Georgia and Hawaii (6,7,8). You are able to keep these 3 items opened + any other item at the same time.

Activity

  1. bradroid commented on Jun 2, 2015

    @bradroid
    Author

    I checked your delete item implementation in the demo, within recycler view adapter:

     viewHolder.buttonDelete.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mItemManger.removeShownLayouts(viewHolder.swipeLayout);
                    mDataset.remove(position);
                    notifyItemRemoved(position);
                    notifyItemRangeChanged(position, mDataset.size());
                    mItemManger.closeAllItems();
                    Toast.makeText(view.getContext(), "Deleted " + viewHolder.textViewData.getText().toString() + "!", Toast.LENGTH_SHORT).show();
                }
    

    I think the problem is in calling this line:
    mItemManger.removeShownLayouts(viewHolder.swipeLayout);

    What this does is it removes the layout from item manager, which sounds logical at first because item is deleted, but this very layout is used for view recycling - so the item manager will ignore not just the deleted item, but all the items that got recycled using it's layout. Hope this makes sense.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions