Scrolling PlayerFragment sheet vertically is awkward #125
Comments
If you try to drag it down from anywhere else than where the somg thumbnail or title is it works just fine. I think it has something do to with the new viewpager that has been added recently. It probably only accepts left and right swipes so you need to add a listener for down swipes too. |
Looking at this tutorial it seems like a Viewpager2 can get top to bottom swipes. So then there was this guy which had a similar problem I think. Another similar problem could be this one. Another solution we might try is to always prioritize top to bottom swipes to Viewpager2 swipes. We would need to check if the user is swiping downwards and if he is, lock the Viewpager and make him move downwards, else unlock the viewpager2. |
Actually, check this out:
|
I'm pretty sure the solution isn't to change the scrolling direction of the viewpager2 but to somehow make it pass vertical scrolling to its container. |
But we still need something like a swipe listener to check for vertical swipes, right? |
This might be a solution? Stackoverflow Or maybe this one is probably a better one |
The first one is using ViewPager instead of ViewPager2. The second one I already tried. |
Ok I asked around the discord servers and someone helped me out with it. His solution was to access the RecyclerView inside the ViewPager2 and disable its nested scrolling with a Kotlin extension function:
Unfortunately it meant I had to convert the CustomViewPager2 class to Kotlin, which I don't speak. Still it's worth it. Although you'll have to download a Kotlin plugin to compile. I wanna learn Kotlin some day anyway. EDIT: I'll commit after PR #186 is tested and merged. |
Damn this bug is hard to get rid off. I have never coded a line in Kotlin, this is also the reason why the app is in Java. I really hope it works. |
Good news! I managed to get it to work in Java! So forget the last update. |
Describe the bug
Due to the newly added viewpager in PlayerFragment, the bottom sheet that the whole fragment is on is not scrolling very well. If you start scrolling vertically where the ViewPager is, it doesn't register. ViewPagers and BottomSheets don't work well together, so it seems this is a common problem.
To Reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: