Re-land gesture detection for hybrid platform views (#61013)

This commit is contained in:
Kaushik Iska
2020-07-07 17:49:54 -07:00
committed by GitHub
parent 3176232cb4
commit ff6b7809bc
7 changed files with 64 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ import static android.view.MotionEvent.PointerProperties;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class MotionEventCodec {
private static long MOTION_EVENT_ID = 1;
public static HashMap<String, Object> encode(MotionEvent event) {
ArrayList<HashMap<String,Object>> pointerProperties = new ArrayList<>();
ArrayList<HashMap<String,Object>> pointerCoords = new ArrayList<>();
@@ -46,6 +48,7 @@ public class MotionEventCodec {
eventMap.put("edgeFlags", event.getEdgeFlags());
eventMap.put("source", event.getSource());
eventMap.put("flags", event.getFlags());
eventMap.put("motionEventId", MOTION_EVENT_ID++);
return eventMap;
}

View File

@@ -28,6 +28,7 @@ String diffMotionEvents(
'source', // Unused by Flutter.
'deviceId', // Android documentation says that's an arbitrary number that shouldn't be depended on.
'action', // Compared separately.
'motionEventId', // TODO(kaushikiska): add support for motion event diffing, https://github.com/flutter/flutter/issues/61022.
]);
diffActions(diff, originalEvent, synthesizedEvent);

View File

@@ -183,6 +183,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
event.edgeFlags,
event.source,
event.flags,
event.motionEventId,
];
}
@@ -219,6 +220,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
eventTime: 723657071,
action: 0,
xPrecision: 1.0,
motionEventId: 1,
),
AndroidMotionEvent(
downTime: 723657071,
@@ -252,6 +254,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
edgeFlags: 0,
source: 4098,
flags: 0,
motionEventId: 2,
),
];
}