io.flutter.app.FlutterActivity Java Examples

The following examples show how to use io.flutter.app.FlutterActivity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlutterAmapPlugin.java    From flutter_amap_plugin with MIT License 5 votes vote down vote up
public static void registerWith(Registrar registrar) {
    FlutterAmapPlugin.registrar = registrar;

    final MethodChannel channel = new MethodChannel(registrar.messenger(), MAP_BASE_CHANNEL);
    channel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));

    final MethodChannel locChannel = new MethodChannel(registrar.messenger(), LOCATION_CHANNEL_NAME);
    locChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.locChannel = locChannel;

    final MethodChannel routeChannel = new MethodChannel(registrar.messenger(), SEARCH_ROUTE_CHANNEL_NAME);
    routeChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.routeChannel = routeChannel;

    final MethodChannel convertChannel = new MethodChannel(registrar.messenger(), SEARCH_CONVERT_CHANNEL_NAME);
    convertChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.convertChannel = convertChannel;

    final MethodChannel navChannel = new MethodChannel(registrar.messenger(), FlutterAMapNavView.NAV_CHANNEL_NAME);
    navChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));

    final FlutterAmapPlugin plugin = new FlutterAmapPlugin(root);

    registrar.platformViewRegistry().registerViewFactory(FlutterAMapView.MAP_CHANNEL_NAME,
            new FlutterAMapViewFactory(plugin.state, registrar));
    registrar.platformViewRegistry().registerViewFactory(FlutterAMapNavView.NAV_CHANNEL_NAME,
            new FlutterAMapNavFactory(plugin.state, registrar));
}