Update dismiss view location in one-handed mode
Updates dismiss view location in one-handed mode using margin instead of padding. Dismiss view has internal padding that ensures it is not against the bottom edge of the display. We were previously using padding to update the dismiss view location in one-handed mode to ensure dismiss view is visible. But when exiting one-handed mode, we cleared the padding and dismiss view remained touching the bottom area of the display. Switching to margin for repositioning dismiss view, when one-handed mode is enabled. This ensures padding is not altered. Update MagnetizedObject to use the same coordinate systems when checking if a MagnetizedObject is in the bounds of a MagneticTarget. MagnetizedObject relied on View#getLocationOnScreen() to determine the location of itself and the location of MagneticTarget. For dragging and determining if pointer location is in the bounds of a MagneticTarget, it used MotionEvent#getRawX/Y(). These two work in different coordinate systems. View#getLocationOnScreen() returns the location in screen coordinates. MotionEvent works in display coordinates. Usually these match. But not in the case of one-handed mode. When one-handed mode is enabled, we translate the screen surface, to move it closer to the bottom edge. View location in terms of screen coordinates does not change. But MotionEvent is still working in display coordinates. This led to an issue where based on screen coordinates a MagneticTarget was in one location and when using those values to compare to MotionEvent, they did not match. Introduced a screenVerticalOffset option to MagneticTarget which allows clients to define how much the screen is offset. That value is used during checks if a MotionEvent pointer location falls into the MagneticTarget bounds or not. Bug: 311251698 Test: atest MagnetizedObjectTest Test: manual, have a bubble and enter one-handed mode, drag the bubble and observer the dismiss view shows up at the same location on the display, drag bubble around the screen, observe bubble is stuck to dismiss view when hovering around it Change-Id: Ie556d880ce9cc0e9bc8f3683e1cd6010142b9de4
Loading
Please register or sign in to comment