RecyclerViewEnhanced icon indicating copy to clipboard operation
RecyclerViewEnhanced copied to clipboard

RecyclerView Footer

Open Mathbl opened this issue 8 years ago • 3 comments

Hi,

I have a RecyclerView with swipe to delete for each rows. I added a footer to my RecyclerView (footer uses a different layout than items and should not be swipeable nor clickable).

I did try to use setUnSwipeableRows(), but it crashes inside handleTouchEven()'s ACTION_DOWN. Would it be possible to make the footer bypass the touch listener? Is there a way to have a footer with actual code?

Mathbl avatar Aug 18 '16 15:08 Mathbl

Information on the setup and the crash log would be more helpful

nikhilpanju avatar Aug 19 '16 04:08 nikhilpanju

Yeah, sorry for the lack of information. I wrote that in a hurry. I had more time to pinpoint the issue, and looks like theres a missing check into ACTION_DOWN.

The crash was happening on line 521 of RecyclerTouchListener.java (nullPointerException on getHeight):

bgView.setMinimumHeight(fgView.getHeight());

Which is normal since my footer does not contain a bgView/fgView, it's a different layout that is not meant to be swipeable.

What I did was adding a check after line 510, something like:

if (unSwipeableRows.contains(touchedPosition)) {
    break;
}

It works for my case, but there may be other places where this check should be added I think.

Mathbl avatar Aug 19 '16 12:08 Mathbl

I have the same problem.. it should be a simple fix

Matty3Run avatar Nov 03 '16 11:11 Matty3Run