DragSortRecycler icon indicating copy to clipboard operation
DragSortRecycler copied to clipboard

Using DragSort recycler with SwipeRefreshLayout

Open ghost opened this issue 10 years ago • 3 comments

Hello,

I have implemented your DragSort Recycler in my RecyclerView. I am also trying to implement the SwipeRefreshLayout on the recyclerview..

The problem I am facing is when I long press and drag the view in downward motion, the SwipeRefreshLayout's setOnRefreshListener gets called preventing me from sorting the view items. I am able to move items in the upward motion.

Any suggestions on this would be very helpful

ghost avatar Feb 23 '15 12:02 ghost

i am facing similar problem as yours. what i am planning to do is, to add / remove either swiperefreshlayout or dragsortrecycler listener programmatically... or maybe dynamically control the swiperefreshlayout using dragstart or dragdrop function...

azizimusa avatar Apr 17 '15 01:04 azizimusa

I was able to get around this problem by enabling and disabling onDragStart/Stop override methods

        dragSortRecycler.setOnDragStateChangedListener(new DragSortRecycler.OnDragStateChangedListener() {
            @Override
            public void onDragStart() {
                mRefreshLayout.setEnabled(false);
            }

            @Override
            public void onDragStop() {
                mRefreshLayout.setEnabled(true);
            }
        });

robgravy avatar May 18 '15 21:05 robgravy

Thanks for this report and for the potential fix, I have not tried this yet so I will leave this open.

emileb avatar May 20 '15 12:05 emileb