Prevent accidental back swipes
See original GitHub issueNewer Android phones rely on swiping the edge of the screen to go back. I noticed it’s very easy to accidentally do this when trying to resize/move the crop box when it’s near the edge of the screen. This can be really annoying.
https://developer.android.com/training/gestures/gesturenav#games
According to this link it’s possible to block this by setting setSystemGestureExclusionRects()
. If you use this to set the blocked area to the touchable area of the crop box you should be good to go. If working correctly you should still be able to swipe back if the crop box is not near the edge of the screen but you won’t accidentally go back if it does.
How to test:
- set phone to use gesture bar (instead of old school 3 button nav bar)
- make the crop box as big as possible
- try resizing the crop box by grabbing the left or right edge and move inward
- back swipe gets triggered
I’m not familiar with the source code of this package so it’s difficult to fix myself, anyone care to try to fix this?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
Ok I think I got it now, can you check?
I downloaded the sample app and started messing around. It’s actually a pretty straightforward fix. Turns out that you can only block the back swipe at most 200dp vertically (which explains the issues I had). So you have to be selective which areas to block (you can’t block the entire screen). I’ll try 60 for each corner and 80 for the center.
So the solution is there but it will take me some time to flesh it out