Re-land gesture detection for hybrid platform views (#61013)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user