saket / InboxRecyclerView

Build expandable descendant navigation, inspired by Google Inbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use raw touch coordinates for tracking pull-to-collapse gesture

saket opened this issue · comments

From Tunous/Dank:

MotionEvent.getRawX/Y methods always return screen coordinates meaning that they are calculated from the top left corner of the device screen. This works incorrectly for when the application is located in the bottom/right split space of the device. The reason for that is the difference in code which checks whether the touched point lies inside of a view (me.saked.dank.utils.touchLiesOn). It deals with coordinates that are calculated from top left corner of the application area and not the screen area.

The fix is to use MotionEvent.getX/Y which return local coordinates that later can be correctly located in view rectangles.