Tracks the motion events received by the FlutterView.
Definition at line 11 of file MotionEventTracker.java.
◆ getInstance()
Definition at line 42 of file MotionEventTracker.java.
42 {
43 if (INSTANCE == null) {
44 INSTANCE = new MotionEventTracker();
45 }
46 return INSTANCE;
47 }
◆ pop()
MotionEvent io.flutter.embedding.android.MotionEventTracker.pop |
( |
@NonNull MotionEventId |
eventId | ) |
|
|
inline |
Returns the MotionEvent corresponding to the eventId while discarding all the motion events that occurred prior to the event represented by the eventId. Returns null if this event was popped or discarded.
Definition at line 76 of file MotionEventTracker.java.
76 {
77
78 while (!unusedEvents.isEmpty() && unusedEvents.peek() < eventId.id) {
79 eventById.remove(unusedEvents.poll());
80 }
81
82
83 if (!unusedEvents.isEmpty() && unusedEvents.peek() == eventId.id) {
84 unusedEvents.poll();
85 }
86
87 MotionEvent event = eventById.get(eventId.id);
88 eventById.remove(eventId.id);
90 }
◆ track()
MotionEventId io.flutter.embedding.android.MotionEventTracker.track |
( |
@NonNull MotionEvent |
event | ) |
|
|
inline |
Tracks the event and returns a unique MotionEventId identifying the event.
Definition at line 56 of file MotionEventTracker.java.
56 {
57 MotionEventId eventId = MotionEventId.createUnique();
58
59
60
61
62
63
64 MotionEvent eventCopy = MotionEvent.obtain(
event);
65 eventById.put(eventId.id, eventCopy);
66 unusedEvents.add(eventId.id);
67 return eventId;
68 }
The documentation for this class was generated from the following file: