timusus / RecyclerView-FastScroll

A simple FastScroller for Android's RecyclerView
Other
1.39k stars 183 forks source link

FastScroll triggers SwipeRefreshLayout #57

Closed GeniusRUS closed 6 years ago

GeniusRUS commented 7 years ago

When you scroll down, the SwipeRefresh call is triggered. But the scroll goes up perfectly. A temporary solution is to set the SweepRefresh setEnabled(false) on start scrolling and setEnabled(true) on stop

ghost commented 6 years ago

Hi, Same problem, here a horrible tricks but that work

swipeRefreshLayout.setOnTouchListener((view, motionEvent) -> {
    boolean triggeredByFastScroll = recyclerView.onTouchEvent(motionEvent);
    if (triggeredByFastScroll) return true;

    return view.onTouchEvent(motionEvent);
});

CrabeMan.

GeniusRUS commented 6 years ago

CrabeMan, thank for your reply. Yep, I solved this problem in the same way. But the developer would be nice to foresee this possibility "out of the box"

timusus commented 6 years ago

I'm not able to reproduce this issue. I've added a SwipeRefreshLayout around the RecyclerView in the sample project, and it is not triggered at all when fast scrolling.

If you can demonstrate the issue via a fork of the sample project, I'm happy to investigate further.

ghost commented 6 years ago

Hi, You can look at this example.

CrabeMan.

timusus commented 6 years ago

I checked out your example, on the branch prevent_touch_event_conflict, and out-commented recyclerView.preventTouchEventConflict(swipeRefreshLayout);. I wasn't able to reproduce the issue. (Testing on Nexus 6P running Android 8.1.0).

A few things:

  1. Can you describe how to reproduce the issue, just in case I'm missing something?
  2. Which device, ROM and Android version are you experiencing this on?
  3. Can you merge the latest changes into your project?
ghost commented 6 years ago

Thanks for your tests, i has actually retest my branch without the recycleView.preventTouchEventConflict. I have unfortunately not succeeded to reproduce the bug. But the bug is still present in my other project. I will investigate this, I'll keep you informed. I'm currently running on Nokia 6 w/ Android 7.1.2

Edit: The problem is because I surround the FastScrollRecyclerView with a FrameLayout. It look like

<Android.support.v4.widget.SwipeRefreshLayout>
     <FrameLayout>
         <other.layout />
         <com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView />
         <other.layout />
     </ FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>

By removing the FrameLayout the problem not appear.

Thanks. CrabeMan.