question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent accidental back swipes

See original GitHub issue

Newer 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:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Janneman84commented, Aug 22, 2022

Ok I think I got it now, can you check?

1reaction
Janneman84commented, Aug 18, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Anyone else keep accidentally performing the "back" gesture ...
You can adjust how large the swipe back gesture area is under Settings>System>Gestures>System navigation>Gesture navigation settings (⚙️ ...
Read more >
Block accidental touches on your Galaxy phone - Samsung
This will prevent any accidental screen touches while your phone's stashed away. From Settings, search for and select Accidental touch protection.
Read more >
How do i disable swipe to go back a page … - Apple Community
I accidentally swipe and go back a page way too often and very frustrating when you have a whole page of info you...
Read more >
How do I disable the touchpad gesture that hits the back ...
TouchGuard function is on the home screen. Activate the feature to prevent accidental clicks and move the slider to set the sensitivity; Step...
Read more >
How do I disable Chrome's two-finger back/forward navigation?
In dev builds of Chrome, they've implemented, refined, and released two-finger swipes left/right ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found