Skip to content

SwipeRefreshLayout touch events collide with SwipeActionAdapter #59

Closed
@J4zen

Description

@J4zen

Hi,

I'm using your library in a SwipeRefreshLayout (to allow for pull down refresh mechanism).
Unfortunately it seems that the pullToRefresh feature hijacks touch events.

For example, if you have the following layout;

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ListView
            android:id="@+id/listViewItems"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </android.support.v4.widget.SwipeRefreshLayout>

And use your SwipeActionAdapter on the ListView listViewItems, when you swipe left for a little bit; then swipe down a little bit (not fully engaging the pullToRefresh in the SwipeRefreshLayout), you can no longer continue to swipe within the item you started swiping in.

The only solution (that I'm aware of) is to disable the swipeRefreshLayout if the user started started swiping, to prevent it from hijacking the touch events in SwipeActionAdapter.
This is currently not possible as there are no events available to indicate when a user started and stopped swiping an item.

This would allow me to do;

            @Override
            public void onSwipeStarted(ListView listView, int position, SwipeDirection direction) {
                swipeRefresh.setEnabled(false);
            }

            @Override
            public void onSwipeEnded(ListView listView, int position, SwipeDirection direction) {
                swipeRefresh.setEnabled(true);
            }

Which fixes the problem.

Regards,
Jeroen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions