Skip to content

Commit

Permalink
Cast MotionEvent timestamps to Number. (flutter#5994)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amirh authored Aug 10, 2018
1 parent 00d7069 commit a389dc5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ private void onTouch(MethodCall call, MethodChannel.Result result) {
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 =
Expand Down Expand Up @@ -233,8 +233,8 @@ private void onTouch(MethodCall call, MethodChannel.Result result) {
}

MotionEvent event = MotionEvent.obtain(
downTime,
eventTime,
downTime.intValue(),
eventTime.intValue(),
action,
pointerCount,
pointerProperties,
Expand Down

0 comments on commit a389dc5

Please sign in to comment.