Unverified Commit 4ee22ed2 authored by Emmanuel Garcia's avatar Emmanuel Garcia Committed by GitHub

Roll Engine from 4463cf40fed9 to 5f0271a38988 + Fix test (#98479)

parent a1a305c9
4463cf40fed98686c1b0020d537f4b80b25b4281
5f0271a38988732c48f55c1244717430816391d3
......@@ -24,7 +24,6 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
final static int STORAGE_PERMISSION_CODE = 1;
MethodChannel mMethodChannel;
TouchPipe mFlutterViewTouchPipe;
// The method result to complete with the Android permission request result.
// This is null when not waiting for the Android permission request;
......@@ -34,12 +33,6 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
return findViewById(FLUTTER_VIEW_ID);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFlutterViewTouchPipe = new TouchPipe(mMethodChannel, getFlutterView());
}
@Override
public void configureFlutterEngine(FlutterEngine flutterEngine) {
DartExecutor executor = flutterEngine.getDartExecutor();
......@@ -56,11 +49,9 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
switch(methodCall.method) {
case "pipeFlutterViewEvents":
mFlutterViewTouchPipe.enable();
result.success(null);
return;
case "stopFlutterViewEvents":
mFlutterViewTouchPipe.disable();
result.success(null);
return;
case "getStoragePermission":
......@@ -82,6 +73,8 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
public void synthesizeEvent(MethodCall methodCall, MethodChannel.Result result) {
MotionEvent event = MotionEventCodec.decode((HashMap<String, Object>) methodCall.arguments());
getFlutterView().dispatchTouchEvent(event);
// TODO(egarciad): Remove invokeMethod since it is not necessary.
mMethodChannel.invokeMethod("onTouch", MotionEventCodec.encode(event));
result.success(null);
}
......
......@@ -13,6 +13,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
import io.flutter.plugin.common.MethodCall;
......@@ -20,23 +21,21 @@ import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.platform.PlatformView;
public class SimplePlatformView implements PlatformView, MethodChannel.MethodCallHandler {
private final TextView view;
private final FrameLayout view;
private final MethodChannel methodChannel;
private final io.flutter.integration.platformviews.TouchPipe touchPipe;
private final TouchPipe touchPipe;
SimplePlatformView(Context context, MethodChannel methodChannel) {
this.methodChannel = methodChannel;
view = new TextView(context) {
view = new FrameLayout(context) {
@Override
public boolean onTouchEvent(MotionEvent event) {
return true;
}
};
view.setTextSize(72);
view.setBackgroundColor(0xff0000ff);
view.setText("Hello from Android view");
this.methodChannel.setMethodCallHandler(this);
touchPipe = new io.flutter.integration.platformviews.TouchPipe(this.methodChannel, view);
touchPipe = new TouchPipe(this.methodChannel, view);
}
@Override
......
......@@ -96,11 +96,6 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
return builder.toString();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void configureFlutterEngine(FlutterEngine flutterEngine) {
DartExecutor executor = flutterEngine.getDartExecutor();
......@@ -140,7 +135,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
public void synthesizeEvent(MethodCall methodCall) {
MotionEvent event = MotionEventCodec.decode((HashMap<String, Object>) methodCall.arguments());
getFlutterView().dispatchTouchEvent(event);
// TODO(egarciad): This can be cleaned up.
// TODO(egarciad): Remove invokeMethod since it is not necessary.
mMethodChannel.invokeMethod("onTouch", MotionEventCodec.encode(event));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment