SlidingPaneLayout items in RecyclerView

I'm populating a RecyclerView with several SlidingPaneLayout items, as to achieve a 'swipe to delete' functionality (basically, dragging an item to the right reveals a DELETE button)

Problem: When I drag an item to the right, it seems like the RecyclerView also intercepts my touches, and if my drag is somewhat diagonal (or not too horizontal) - the RecyclerView starts scrolling and the SlidingPaneLayout cancels the closing/opening of the pane

I've tried adding a touch listener to each SlidingPaneLayout that prevents the RecyclerView from intercepting the touches once ACTION_DOWN is performed on the SlidingPaneLayout, but that's not good as it blocks scrolling right away

ideas?

Answers


The solution:

Prevent the RecyclerView from intercepting touch events given the following condition:

10% < sliding pane offset < 90%

i.e

ViewParent parent = ...; // Should be the RecyclerView
if (slideOffset > 0.1 && slideOffset < 0.9) {
    parent.requestDisallowInterceptTouchEvent(true);
} else {
    parent.requestDisallowInterceptTouchEvent(false);
}

Need Your Help

Collision detection Graphics 2D

java graphics 2d collision-detection

I'm building a simulator that is based on car collisions on the road. The "cars" are basic rectangles drawn using fillRect and setting random x and y coordinates for each car. The kinematics portio...

jquery animate() not working in chrome and firefox

jquery google-chrome jquery-animate

The following jQuery animate function is not working in chrome and Firefox any idea why? It works in Safari perfectly.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.