Android actionmode and moving item up-down

155 Views Asked by At

I'm trying to activate the movement (up and down) to move a recycleview item after the action mode has been activated.

Basically I have implemented the viewHolder onLongPress () like this:

@Override
        public void onLongPress(MotionEvent motionEvent) {

            mTouchHelper.startDrag(this);
            if (!isMultiSelect)
             {
                selectedIds = new HashMap<>();
                isMultiSelect = true;
                if (actionMode == null) {
                    actionMode = ((AppCompatActivity) parentFragment.requireActivity()).
                            startSupportActionMode(new ActionBarCallback(parentFragment.getActivity()
                            )); //show ActionMode.
                }
            }
            multiSelect(getAdapterPosition());
        } 

When I press and hold the item for the first time, action mode is activated and I do not have the possibility to move the item up and down. I am trying to allow the movement of the item when the actionmode is activated and to deactivate the actionmode when I am moving the element.

Do you have any ideas on how I can make action mode and item moving coexist?

1

There are 1 best solutions below

0
On

I think this article may be useful, https://proandroiddev.com/a-guide-to-recyclerview-selection-3ed9f2381504

I also used Google Keep. In general, the ActionMode can work with "normal UI" http://prntscr.com/vr4j7n

There is no conflict between the movement(up or down) of RecycleView and ActionMode.