Search code examples
androidandroid-recyclerviewitemtouchhelper

Disable swipe of recyclerview cell for particular amount of time


I have a recyclerview. Each cell of recyclerview has an associated file. I am using ItemTouchHelper for swiping. When a user swipes a cell, i want to disable the swipe of other cells as long as the the file associated with swiped cell does not get deleted. How do i enable and disable swiping for a particular amount of time. I went through questions on this on stack, but they mostly answers how to disable swipe for particular position, which i don't want.


Solution

  • Just override the following method

    @Override
    public boolean isItemViewSwipeEnabled()
    {
        return mSwipable;
    }