Cast MotionEvent timestamps to Number. (#5994)

Dart might choose to marshall the timestamps to a Java Long or Integer.
Casting directly to int was crashing when the timestamp wass a Long.
This commit is contained in:
amirh 2018-08-10 12:46:49 -07:00 committed by GitHub
parent 00d7069677
commit a389dc595f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,8 +204,8 @@ public class PlatformViewsController implements MethodChannel.MethodCallHandler
float density = mFlutterView.getContext().getResources().getDisplayMetrics().density;
int id = (int) args.get(0);
int downTime = (int) args.get(1);
int eventTime = (int) args.get(2);
Number downTime = (Number) args.get(1);
Number eventTime = (Number) args.get(2);
int action = (int) args.get(3);
int pointerCount = (int) args.get(4);
PointerProperties[] pointerProperties =
@ -233,8 +233,8 @@ public class PlatformViewsController implements MethodChannel.MethodCallHandler
}
MotionEvent event = MotionEvent.obtain(
downTime,
eventTime,
downTime.intValue(),
eventTime.intValue(),
action,
pointerCount,
pointerProperties,