You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement View.getLocationInWindow() and MotionEvent.offsetLocation()
This is needed for NestedScrollViews to detect and correct parent scroll offset
This commit is contained in:
@@ -1636,6 +1636,8 @@ public final class MotionEvent extends InputEvent {
|
||||
ev.action = other.action;
|
||||
ev.coord_x = other.coord_x;
|
||||
ev.coord_y = other.coord_y;
|
||||
ev.raw_x = other.raw_x;
|
||||
ev.raw_y = other.raw_y;
|
||||
return ev;
|
||||
}
|
||||
|
||||
@@ -2731,7 +2733,9 @@ public final class MotionEvent extends InputEvent {
|
||||
*/
|
||||
public final void offsetLocation(float deltaX, float deltaY) {
|
||||
if (deltaX != 0.0f || deltaY != 0.0f) {
|
||||
nativeOffsetLocation(mNativePtr, deltaX, deltaY);
|
||||
// nativeOffsetLocation(mNativePtr, deltaX, deltaY);
|
||||
this.coord_x += deltaX;
|
||||
this.coord_y += deltaY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,7 +1115,9 @@ public class View extends Object {
|
||||
return new IBinder();
|
||||
}
|
||||
|
||||
public void getLocationInWindow(int[] xxx) {}
|
||||
public void getLocationInWindow(int[] location) {
|
||||
getLocationOnScreen(location);
|
||||
}
|
||||
|
||||
public void addOnAttachStateChangeListener(OnAttachStateChangeListener l) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user