From a389dc595ff5bced0950a5fd9b429d19d8590f3d Mon Sep 17 00:00:00 2001 From: amirh Date: Fri, 10 Aug 2018 12:46:49 -0700 Subject: [PATCH] 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. --- .../flutter/plugin/platform/PlatformViewsController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 6509d39c3da..969f527cbe6 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -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,