daimajia / daimajia/AndroidSwipeLayout
SwipeLayout as items in a RecyclerView misses touch/click events sometimes.
- Dominant language
- Java
- Stars
- 12.3k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Having a `SwipeLayout` as items in a `RecyclerView` and wanting to get clicks on the elements in the `RecyclerView` somewhat works some of the time but not always. Some events seem to get lost.
Sometimes you get a click indication but nothing happens. Looking further into it with the debugger the `GestureDetector` in the `RecyclerItemClickListener` doesn't always detect the `singleTapUp`.
Just changing the item layout to not be a SwipeLayout makes it work 100% of the time (still using the same `RecyclerItemClickListener`).
Note: `RecyclerItemClickListener` is the standard one for `RecyclerView` included in the demo.
Theory: SwipeLayout swallows/stops parents from receiving some `MotionEvent`s that it shouldn't. It does use `parent.requestDisallowInterceptTouchEvent` in a few places for example.
Example code:
``` java
recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
//Not always triggered when View is a SwipeLayout
}
}));
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.