SwipeLayout icon indicating copy to clipboard operation
SwipeLayout copied to clipboard

I drag an item and I want the other open items to be closed.

Open cesarvv opened this issue 3 years ago • 1 comments

I drag an item and I want the other open items to be closed. Is there any configuration?

cesarvv avatar Nov 29 '21 12:11 cesarvv

Use it like this. Hope this will help you. This is for right open, change is accordingly...

 if (position == selectedPos && itemHolder.swipeLayout.isRightOpen()){
            itemHolder.swipeLayout.close(true);
        }

and in onswipe listener update the selectedPos

                swipeLayout.setOnActionsListener(new SwipeLayout.SwipeActionsListener() {
               @Override
               public void onOpen(int direction, boolean isContinuous) {
                   notifyItemChanged(selectedPos);
                   selectedPos = getAdapterPosition();
                   if (direction == SwipeLayout.LEFT && isContinuous) {
                       if (getAdapterPosition() != NO_POSITION) {
                           delConfirmation(itemView.getContext(), getAdapterPosition(), swipeLayout);
                       }
                   }
               }
               @Override
               public void onClose() {
                   //called when closing
               }
           });

aman4india avatar Nov 16 '22 14:11 aman4india