AdevintaSpain/Barista

swipeViewPagerForward() method performs a back gesture instead of a viewpager-swipe

ben04 opened this issue · 2 comments

ben04 commented

Library Version:

2.3.0

Describe the Bug:

I'm using the Barista methods to swipe in my ViewPager. However, on my new test device (Samsung s20 FE) the method swipeViewPagerForward() performs a back gesture instead of a swipe in my ViewPager.
If I disable navigation gestures and use the navigation bar (with its back button) instead, the swipe is performed on the ViewPager.
On my other test device (Samsung S8) this behaviour can not be reproduced, so there the swipe is performed on the ViewPager even if navigation gestures are enabled.

Expected Behavior:

The methods performs a swipe in my ViewPager.

Hello @ben04! That's super weird. I think as this is something super related to your test device, I think you are the most capable of trying to reproduce and fix it. Do you think that would be feasible? Thanks!

ben04 commented

I had a look into the code that is performed with the swipeViewPagerForward() method - it calls the swipeLeft() method:

private const val EDGE_FUZZ_FACTOR = 0.083f
private const val ALMOST_RIGHT = 1 - EDGE_FUZZ_FACTOR

@JvmStatic
fun swipeLeft(): ViewAction {
    return swipe(from = Pair(ALMOST_RIGHT, CENTER), to = Pair(LEFT, CENTER))
}

So I guess the behaviour could be fixed by increasing the EDGE_FUZZ_FACTOR constant a little bit.

However, when changing back to navigation gestures on my test device, I also found the possibility to change the gesture sensitivity (the area that is used to detect back swipes). By reducing that from position 2 (default) to 1, I could fix the incorrect back gesture in my tests as well.