代码整理
This commit is contained in:
parent
080c198951
commit
cd017f876b
45
README.md
45
README.md
|
@ -8,11 +8,7 @@
|
||||||
## 准备工作
|
## 准备工作
|
||||||
* 登录[高德开放平台官网](https://lbs.amap.com/)申请ApiKey。Android平台申请配置key请参考[Android获取key](https://lbs.amap.com/api/poi-sdk-android/develop/create-project/get-key/?sug_index=2), iOS平台申请配置请参考[iOS获取key](https://lbs.amap.com/api/poi-sdk-ios/develop/create-project/get-key/?sug_index=1)。
|
* 登录[高德开放平台官网](https://lbs.amap.com/)申请ApiKey。Android平台申请配置key请参考[Android获取key](https://lbs.amap.com/api/poi-sdk-android/develop/create-project/get-key/?sug_index=2), iOS平台申请配置请参考[iOS获取key](https://lbs.amap.com/api/poi-sdk-ios/develop/create-project/get-key/?sug_index=1)。
|
||||||
* 引入高德地图SDK,Android平台请参考[Android Sudio配置工程](https://lbs.amap.com/api/android-sdk/guide/create-project/android-studio-create-project), iOS平台请参考[ios安装地图SDK](https://lbs.amap.com/api/ios-sdk/guide/create-project/cocoapods)
|
* 引入高德地图SDK,Android平台请参考[Android Sudio配置工程](https://lbs.amap.com/api/android-sdk/guide/create-project/android-studio-create-project), iOS平台请参考[ios安装地图SDK](https://lbs.amap.com/api/ios-sdk/guide/create-project/cocoapods)
|
||||||
* iOS端插件使用特殊配置:Flutter 1.22.0 之前(之后的版本可以不添加该配置),iOS端的UiKitView还只是preview状态, 默认是不支持的, 需要手动打开开关, 需要在iOS工程的info.plist添加如下配置:
|
|
||||||
``` XML
|
|
||||||
<key>io.flutter.embedded_views_preview</key>
|
|
||||||
<string>YES</string>
|
|
||||||
```
|
|
||||||
|
|
||||||
## 使用示例
|
## 使用示例
|
||||||
``` Dart
|
``` Dart
|
||||||
|
@ -20,7 +16,7 @@ import 'package:amap_map_example/base_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:amap_map/amap_map.dart';
|
import 'package:amap_map/amap_map.dart';
|
||||||
import 'package:amap_map/amap_map.dart';
|
import 'package:x_amap_base/x_amap_base.dart';
|
||||||
|
|
||||||
class ShowMapPage extends BasePage {
|
class ShowMapPage extends BasePage {
|
||||||
ShowMapPage(String title, String subTitle) : super(title, subTitle);
|
ShowMapPage(String title, String subTitle) : super(title, subTitle);
|
||||||
|
@ -40,7 +36,6 @@ class _ShowMapPageState extends State<_ShowMapPageBody> {
|
||||||
target: LatLng(39.909187, 116.397451),
|
target: LatLng(39.909187, 116.397451),
|
||||||
zoom: 10.0,
|
zoom: 10.0,
|
||||||
);
|
);
|
||||||
List<Widget> _approvalNumberWidget = List<Widget>();
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final AMapWidget map = AMapWidget(
|
final AMapWidget map = AMapWidget(
|
||||||
|
@ -50,25 +45,11 @@ class _ShowMapPageState extends State<_ShowMapPageBody> {
|
||||||
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints.expand(),
|
constraints: BoxConstraints.expand(),
|
||||||
child: Stack(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
child: map,
|
child: map,
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
right: 10,
|
|
||||||
bottom: 15,
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: _approvalNumberWidget),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,29 +57,9 @@ class _ShowMapPageState extends State<_ShowMapPageBody> {
|
||||||
void onMapCreated(AMapController controller) {
|
void onMapCreated(AMapController controller) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_mapController = controller;
|
_mapController = controller;
|
||||||
getApprovalNumber();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取审图号
|
|
||||||
void getApprovalNumber() async {
|
|
||||||
//普通地图审图号
|
|
||||||
String mapContentApprovalNumber =
|
|
||||||
await _mapController?.getMapContentApprovalNumber();
|
|
||||||
//卫星地图审图号
|
|
||||||
String satelliteImageApprovalNumber =
|
|
||||||
await _mapController?.getSatelliteImageApprovalNumber();
|
|
||||||
setState(() {
|
|
||||||
if (null != mapContentApprovalNumber) {
|
|
||||||
_approvalNumberWidget.add(Text(mapContentApprovalNumber));
|
|
||||||
}
|
|
||||||
if (null != satelliteImageApprovalNumber) {
|
|
||||||
_approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
print('地图审图号(普通地图): $mapContentApprovalNumber');
|
|
||||||
print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
group 'com.amap.flutter.amap_map'
|
group 'com.amap.flutter.map'
|
||||||
version '1.0'
|
version '1.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.allprojects {
|
rootProject.allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest package="com.amap.flutter.map"></manifest>
|
||||||
package="com.amap.flutter.amap_map">
|
|
||||||
</manifest>
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
import com.amap.flutter.map.utils.LogUtil;
|
import com.amap.flutter.map.utils.LogUtil;
|
||||||
|
|
||||||
|
|
||||||
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
||||||
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
|
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
|
||||||
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
|
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
|
||||||
|
@ -23,10 +22,11 @@ public class AMapFlutterMapPlugin implements
|
||||||
FlutterPlugin,
|
FlutterPlugin,
|
||||||
ActivityAware {
|
ActivityAware {
|
||||||
private static final String CLASS_NAME = "AMapFlutterMapPlugin";
|
private static final String CLASS_NAME = "AMapFlutterMapPlugin";
|
||||||
private FlutterPluginBinding pluginBinding;
|
private static final String VIEW_TYPE = "com.amap.flutter.map";
|
||||||
private Lifecycle lifecycle;
|
private Lifecycle lifecycle;
|
||||||
|
|
||||||
private static final String VIEW_TYPE = "com.amap.flutter.map";
|
public AMapFlutterMapPlugin() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerWith(PluginRegistry.Registrar registrar) {
|
public static void registerWith(PluginRegistry.Registrar registrar) {
|
||||||
LogUtil.i(CLASS_NAME, "registerWith=====>");
|
LogUtil.i(CLASS_NAME, "registerWith=====>");
|
||||||
|
@ -58,15 +58,11 @@ public class AMapFlutterMapPlugin implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AMapFlutterMapPlugin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// FlutterPlugin
|
// FlutterPlugin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
|
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
|
||||||
LogUtil.i(CLASS_NAME, "onAttachedToEngine==>");
|
LogUtil.i(CLASS_NAME, "onAttachedToEngine==>");
|
||||||
pluginBinding = binding;
|
|
||||||
binding
|
binding
|
||||||
.getPlatformViewRegistry()
|
.getPlatformViewRegistry()
|
||||||
.registerViewFactory(
|
.registerViewFactory(
|
||||||
|
@ -85,7 +81,6 @@ public class AMapFlutterMapPlugin implements
|
||||||
@Override
|
@Override
|
||||||
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
|
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
|
||||||
LogUtil.i(CLASS_NAME, "onDetachedFromEngine==>");
|
LogUtil.i(CLASS_NAME, "onDetachedFromEngine==>");
|
||||||
pluginBinding = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.amap.flutter.map;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
|
||||||
import com.amap.api.maps.AMapOptions;
|
import com.amap.api.maps.AMapOptions;
|
||||||
import com.amap.api.maps.model.CameraPosition;
|
import com.amap.api.maps.model.CameraPosition;
|
||||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||||
|
@ -11,7 +10,6 @@ import com.amap.api.maps.model.MyLocationStyle;
|
||||||
import com.amap.flutter.map.core.AMapOptionsSink;
|
import com.amap.flutter.map.core.AMapOptionsSink;
|
||||||
import com.amap.flutter.map.utils.LogUtil;
|
import com.amap.flutter.map.utils.LogUtil;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.flutter.plugin.common.BinaryMessenger;
|
import io.flutter.plugin.common.BinaryMessenger;
|
||||||
|
@ -67,7 +65,7 @@ class AMapOptionsBuilder implements AMapOptionsSink {
|
||||||
&& anchorY <= 1.0
|
&& anchorY <= 1.0
|
||||||
&& anchorY >= 0) {
|
&& anchorY >= 0) {
|
||||||
|
|
||||||
aMapPlatformView.getMapController().setScreenAnchor( anchorX, anchorY);
|
aMapPlatformView.getMapController().setScreenAnchor(anchorX, anchorY);
|
||||||
}
|
}
|
||||||
|
|
||||||
aMapPlatformView.getMapController().setMinZoomLevel(minZoomLevel);
|
aMapPlatformView.getMapController().setMinZoomLevel(minZoomLevel);
|
||||||
|
|
|
@ -42,18 +42,14 @@ public class AMapPlatformView
|
||||||
PlatformView {
|
PlatformView {
|
||||||
private static final String CLASS_NAME = "AMapPlatformView";
|
private static final String CLASS_NAME = "AMapPlatformView";
|
||||||
private final MethodChannel methodChannel;
|
private final MethodChannel methodChannel;
|
||||||
|
private final Map<String, MyMethodCallHandler> myMethodCallHandlerMap;
|
||||||
private MapController mapController;
|
private MapController mapController;
|
||||||
private MarkersController markersController;
|
private MarkersController markersController;
|
||||||
private PolylinesController polylinesController;
|
private PolylinesController polylinesController;
|
||||||
private PolygonsController polygonsController;
|
private PolygonsController polygonsController;
|
||||||
|
|
||||||
private TextureMapView mapView;
|
private TextureMapView mapView;
|
||||||
|
|
||||||
private boolean disposed = false;
|
private boolean disposed = false;
|
||||||
|
|
||||||
private final Map<String, MyMethodCallHandler> myMethodCallHandlerMap;
|
|
||||||
|
|
||||||
AMapPlatformView(int id,
|
AMapPlatformView(int id,
|
||||||
Context context,
|
Context context,
|
||||||
BinaryMessenger binaryMessenger,
|
BinaryMessenger binaryMessenger,
|
||||||
|
|
|
@ -23,6 +23,7 @@ class AMapPlatformViewFactory extends PlatformViewFactory {
|
||||||
private static final String CLASS_NAME = "AMapPlatformViewFactory";
|
private static final String CLASS_NAME = "AMapPlatformViewFactory";
|
||||||
private final BinaryMessenger binaryMessenger;
|
private final BinaryMessenger binaryMessenger;
|
||||||
private final LifecycleProvider lifecycleProvider;
|
private final LifecycleProvider lifecycleProvider;
|
||||||
|
|
||||||
AMapPlatformViewFactory(BinaryMessenger binaryMessenger,
|
AMapPlatformViewFactory(BinaryMessenger binaryMessenger,
|
||||||
LifecycleProvider lifecycleProvider) {
|
LifecycleProvider lifecycleProvider) {
|
||||||
super(StandardMessageCodec.INSTANCE);
|
super(StandardMessageCodec.INSTANCE);
|
||||||
|
@ -37,13 +38,13 @@ class AMapPlatformViewFactory extends PlatformViewFactory {
|
||||||
try {
|
try {
|
||||||
ConvertUtil.density = context.getResources().getDisplayMetrics().density;
|
ConvertUtil.density = context.getResources().getDisplayMetrics().density;
|
||||||
params = (Map<String, Object>) args;
|
params = (Map<String, Object>) args;
|
||||||
LogUtil.i(CLASS_NAME,"create params==>" + params);
|
LogUtil.i(CLASS_NAME, "create params==>" + params);
|
||||||
if (params.containsKey("privacyStatement")) {
|
if (params.containsKey("privacyStatement")) {
|
||||||
ConvertUtil.setPrivacyStatement(context, params.get("privacyStatement"));
|
ConvertUtil.setPrivacyStatement(context, params.get("privacyStatement"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Object options = ((Map<String, Object>) args).get("options");
|
Object options = ((Map<String, Object>) args).get("options");
|
||||||
if(null != options) {
|
if (null != options) {
|
||||||
ConvertUtil.interpretAMapOptions(options, builder);
|
ConvertUtil.interpretAMapOptions(options, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.amap.flutter.map;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
import io.flutter.plugin.common.MethodCall;
|
import io.flutter.plugin.common.MethodCall;
|
||||||
import io.flutter.plugin.common.MethodChannel;
|
import io.flutter.plugin.common.MethodChannel;
|
||||||
|
|
||||||
|
@ -14,10 +13,12 @@ import io.flutter.plugin.common.MethodChannel;
|
||||||
*/
|
*/
|
||||||
public interface MyMethodCallHandler {
|
public interface MyMethodCallHandler {
|
||||||
|
|
||||||
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result);
|
void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取注册的{@link io.flutter.plugin.common.MethodCall#method}
|
* 获取注册的{@link io.flutter.plugin.common.MethodCall#method}
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract String[] getRegisterMethodIdArray();
|
String[] getRegisterMethodIdArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@ import com.amap.flutter.map.utils.LogUtil;
|
||||||
public class ProxyLifecycleProvider
|
public class ProxyLifecycleProvider
|
||||||
implements
|
implements
|
||||||
Application.ActivityLifecycleCallbacks,
|
Application.ActivityLifecycleCallbacks,
|
||||||
LifecycleOwner,
|
LifecycleOwner {
|
||||||
LifecycleProvider {
|
|
||||||
private static final String CLASS_NAME = "ProxyLifecycleProvider";
|
private static final String CLASS_NAME = "ProxyLifecycleProvider";
|
||||||
private final LifecycleRegistry lifecycle = new LifecycleRegistry(this);
|
private final LifecycleRegistry lifecycle = new LifecycleRegistry(this);
|
||||||
private final int registrarActivityHashCode;
|
private final int registrarActivityHashCode;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.amap.api.maps.model.CameraPosition;
|
||||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||||
import com.amap.api.maps.model.LatLngBounds;
|
import com.amap.api.maps.model.LatLngBounds;
|
||||||
import com.amap.api.maps.model.MyLocationStyle;
|
import com.amap.api.maps.model.MyLocationStyle;
|
||||||
import com.amap.api.maps.model.MyTrafficStyle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author whm
|
* @author whm
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.amap.flutter.map.core;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.AMap;
|
||||||
|
@ -43,16 +42,15 @@ public class MapController
|
||||||
AMap.OnMapClickListener,
|
AMap.OnMapClickListener,
|
||||||
AMap.OnMapLongClickListener,
|
AMap.OnMapLongClickListener,
|
||||||
AMap.OnPOIClickListener {
|
AMap.OnPOIClickListener {
|
||||||
|
private static final String CLASS_NAME = "MapController";
|
||||||
private static boolean hasStarted = false;
|
private static boolean hasStarted = false;
|
||||||
private final MethodChannel methodChannel;
|
private final MethodChannel methodChannel;
|
||||||
private final AMap amap;
|
private final AMap amap;
|
||||||
private final TextureMapView mapView;
|
private final TextureMapView mapView;
|
||||||
private MethodChannel.Result mapReadyResult;
|
|
||||||
protected int[] myArray = {};
|
protected int[] myArray = {};
|
||||||
|
private MethodChannel.Result mapReadyResult;
|
||||||
private static final String CLASS_NAME = "MapController";
|
|
||||||
|
|
||||||
private boolean mapLoaded = false;
|
private boolean mapLoaded = false;
|
||||||
|
private boolean myLocationShowing = false;
|
||||||
|
|
||||||
public MapController(MethodChannel methodChannel, TextureMapView mapView) {
|
public MapController(MethodChannel methodChannel, TextureMapView mapView) {
|
||||||
this.methodChannel = methodChannel;
|
this.methodChannel = methodChannel;
|
||||||
|
@ -72,7 +70,6 @@ public class MapController
|
||||||
return Const.METHOD_ID_LIST_FOR_MAP;
|
return Const.METHOD_ID_LIST_FOR_MAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
||||||
LogUtil.i(CLASS_NAME, "doMethodCall===>" + call.method);
|
LogUtil.i(CLASS_NAME, "doMethodCall===>" + call.method);
|
||||||
|
@ -89,38 +86,27 @@ public class MapController
|
||||||
mapReadyResult = result;
|
mapReadyResult = result;
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_SATELLITE_IMAGE_APPROVAL_NUMBER:
|
case Const.METHOD_MAP_SATELLITE_IMAGE_APPROVAL_NUMBER:
|
||||||
if (null != amap) {
|
|
||||||
result.success(amap.getSatelliteImageApprovalNumber());
|
result.success(amap.getSatelliteImageApprovalNumber());
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_CONTENT_APPROVAL_NUMBER:
|
case Const.METHOD_MAP_CONTENT_APPROVAL_NUMBER:
|
||||||
if (null != amap) {
|
|
||||||
result.success(amap.getMapContentApprovalNumber());
|
result.success(amap.getMapContentApprovalNumber());
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_UPDATE:
|
case Const.METHOD_MAP_UPDATE:
|
||||||
if (amap != null) {
|
|
||||||
ConvertUtil.interpretAMapOptions(call.argument("options"), this);
|
ConvertUtil.interpretAMapOptions(call.argument("options"), this);
|
||||||
result.success(ConvertUtil.cameraPositionToMap(getCameraPosition()));
|
result.success(ConvertUtil.cameraPositionToMap(getCameraPosition()));
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_MOVE_CAMERA:
|
case Const.METHOD_MAP_MOVE_CAMERA:
|
||||||
if (null != amap) {
|
|
||||||
final CameraUpdate cameraUpdate = ConvertUtil.toCameraUpdate(call.argument("cameraUpdate"));
|
final CameraUpdate cameraUpdate = ConvertUtil.toCameraUpdate(call.argument("cameraUpdate"));
|
||||||
final Object animatedObject = call.argument("animated");
|
final Object animatedObject = call.argument("animated");
|
||||||
final Object durationObject = call.argument("duration");
|
final Object durationObject = call.argument("duration");
|
||||||
|
|
||||||
moveCamera(cameraUpdate, animatedObject, durationObject);
|
moveCamera(cameraUpdate, animatedObject, durationObject);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_SET_RENDER_FPS:
|
case Const.METHOD_MAP_SET_RENDER_FPS:
|
||||||
if (null != amap) {
|
|
||||||
amap.setRenderFps((Integer) call.argument("fps"));
|
amap.setRenderFps((Integer) call.argument("fps"));
|
||||||
result.success(null);
|
result.success(null);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_TAKE_SNAPSHOT:
|
case Const.METHOD_MAP_TAKE_SNAPSHOT:
|
||||||
if (amap != null) {
|
|
||||||
final MethodChannel.Result _result = result;
|
final MethodChannel.Result _result = result;
|
||||||
amap.getMapScreenShot(new AMap.OnMapScreenShotListener() {
|
amap.getMapScreenShot(new AMap.OnMapScreenShotListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,13 +123,10 @@ public class MapController
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Const.METHOD_MAP_CLEAR_DISK:
|
case Const.METHOD_MAP_CLEAR_DISK:
|
||||||
if (null != amap) {
|
|
||||||
amap.removecache();
|
amap.removecache();
|
||||||
result.success(null);
|
result.success(null);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtil.w(CLASS_NAME, "onMethodCall not find methodId:" + call.method);
|
LogUtil.w(CLASS_NAME, "onMethodCall not find methodId:" + call.method);
|
||||||
|
@ -187,8 +170,6 @@ public class MapController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean myLocationShowing = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMyLocationStyle(MyLocationStyle myLocationStyle) {
|
public void setMyLocationStyle(MyLocationStyle myLocationStyle) {
|
||||||
if (null != amap) {
|
if (null != amap) {
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package com.amap.flutter.map.overlays;
|
package com.amap.flutter.map.overlays;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.AMap;
|
||||||
import com.amap.api.maps.TextureMapView;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import io.flutter.plugin.common.MethodChannel;
|
import io.flutter.plugin.common.MethodChannel;
|
||||||
|
@ -23,7 +18,8 @@ public abstract class AbstractOverlayController<T> {
|
||||||
protected final Map<String, String> idMapByOverlyId;
|
protected final Map<String, String> idMapByOverlyId;
|
||||||
protected final MethodChannel methodChannel;
|
protected final MethodChannel methodChannel;
|
||||||
protected final AMap amap;
|
protected final AMap amap;
|
||||||
public AbstractOverlayController(MethodChannel methodChannel, AMap amap){
|
|
||||||
|
public AbstractOverlayController(MethodChannel methodChannel, AMap amap) {
|
||||||
this.methodChannel = methodChannel;
|
this.methodChannel = methodChannel;
|
||||||
this.amap = amap;
|
this.amap = amap;
|
||||||
controllerMapByDartId = new HashMap<String, T>(12);
|
controllerMapByDartId = new HashMap<String, T>(12);
|
||||||
|
|
|
@ -30,12 +30,17 @@ class MarkerController implements MarkerOptionsSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatLng getPosition() {
|
public LatLng getPosition() {
|
||||||
if(null != marker) {
|
if (null != marker) {
|
||||||
return marker.getPosition();
|
return marker.getPosition();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition(LatLng position) {
|
||||||
|
marker.setPosition(position);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAlpha(float alpha) {
|
public void setAlpha(float alpha) {
|
||||||
marker.setAlpha(alpha);
|
marker.setAlpha(alpha);
|
||||||
|
@ -71,11 +76,6 @@ class MarkerController implements MarkerOptionsSink {
|
||||||
marker.setSnippet(snippet);
|
marker.setSnippet(snippet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(LatLng position) {
|
|
||||||
marker.setPosition(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotation(float rotation) {
|
public void setRotation(float rotation) {
|
||||||
marker.setRotateAngle(rotation);
|
marker.setRotateAngle(rotation);
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.amap.flutter.map.overlays.marker;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.amap.flutter.map.overlays.marker.MarkerOptionsSink;
|
|
||||||
import com.amap.flutter.map.utils.ConvertUtil;
|
import com.amap.flutter.map.utils.ConvertUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -53,7 +52,7 @@ public class MarkerUtil {
|
||||||
}
|
}
|
||||||
final Object rotation = data.get("rotation");
|
final Object rotation = data.get("rotation");
|
||||||
if (rotation != null) {
|
if (rotation != null) {
|
||||||
sink.setRotation(Math.abs(360- ConvertUtil.toFloat(rotation)));
|
sink.setRotation(Math.abs(360 - ConvertUtil.toFloat(rotation)));
|
||||||
}
|
}
|
||||||
final Object visible = data.get("visible");
|
final Object visible = data.get("visible");
|
||||||
if (visible != null) {
|
if (visible != null) {
|
||||||
|
@ -66,7 +65,7 @@ public class MarkerUtil {
|
||||||
|
|
||||||
final Object infoWindowEnable = data.get("infoWindowEnable");
|
final Object infoWindowEnable = data.get("infoWindowEnable");
|
||||||
|
|
||||||
if(infoWindowEnable != null) {
|
if (infoWindowEnable != null) {
|
||||||
sink.setInfoWindowEnable(ConvertUtil.toBoolean(infoWindowEnable));
|
sink.setInfoWindowEnable(ConvertUtil.toBoolean(infoWindowEnable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,10 @@ import android.text.TextUtils;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.AMap;
|
||||||
import com.amap.api.maps.TextureMapView;
|
|
||||||
import com.amap.api.maps.model.LatLng;
|
import com.amap.api.maps.model.LatLng;
|
||||||
import com.amap.api.maps.model.Marker;
|
import com.amap.api.maps.model.Marker;
|
||||||
import com.amap.api.maps.model.MarkerOptions;
|
import com.amap.api.maps.model.MarkerOptions;
|
||||||
import com.amap.api.maps.model.Poi;
|
import com.amap.api.maps.model.Poi;
|
||||||
import com.amap.api.maps.model.Polyline;
|
|
||||||
import com.amap.flutter.map.MyMethodCallHandler;
|
import com.amap.flutter.map.MyMethodCallHandler;
|
||||||
import com.amap.flutter.map.overlays.AbstractOverlayController;
|
import com.amap.flutter.map.overlays.AbstractOverlayController;
|
||||||
import com.amap.flutter.map.utils.Const;
|
import com.amap.flutter.map.utils.Const;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.amap.flutter.map.overlays.polygon;
|
||||||
import com.amap.api.maps.model.AMapPara;
|
import com.amap.api.maps.model.AMapPara;
|
||||||
import com.amap.api.maps.model.LatLng;
|
import com.amap.api.maps.model.LatLng;
|
||||||
import com.amap.api.maps.model.Polygon;
|
import com.amap.api.maps.model.Polygon;
|
||||||
import com.amap.api.maps.model.PolygonOptions;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -13,11 +12,12 @@ import java.util.List;
|
||||||
* @mail hongming.whm@alibaba-inc.com
|
* @mail hongming.whm@alibaba-inc.com
|
||||||
* @since
|
* @since
|
||||||
*/
|
*/
|
||||||
class PolygonController implements PolygonOptionsSink{
|
class PolygonController implements PolygonOptionsSink {
|
||||||
|
|
||||||
private final Polygon polygon;
|
private final Polygon polygon;
|
||||||
private final String id;
|
private final String id;
|
||||||
PolygonController(Polygon polygon){
|
|
||||||
|
PolygonController(Polygon polygon) {
|
||||||
this.polygon = polygon;
|
this.polygon = polygon;
|
||||||
this.id = polygon.getId();
|
this.id = polygon.getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.amap.flutter.map.overlays.polygon;
|
package com.amap.flutter.map.overlays.polygon;
|
||||||
|
|
||||||
import com.amap.api.maps.model.AMapPara;
|
import com.amap.api.maps.model.AMapPara;
|
||||||
import com.amap.api.maps.model.BitmapDescriptor;
|
|
||||||
import com.amap.api.maps.model.LatLng;
|
import com.amap.api.maps.model.LatLng;
|
||||||
import com.amap.api.maps.model.PolygonOptions;
|
import com.amap.api.maps.model.PolygonOptions;
|
||||||
import com.amap.api.maps.model.PolylineOptions;
|
|
||||||
import com.amap.flutter.map.overlays.polyline.PolylineOptionsSink;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,13 +14,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
class PolygonOptionsBuilder implements PolygonOptionsSink {
|
class PolygonOptionsBuilder implements PolygonOptionsSink {
|
||||||
final PolygonOptions polygonOptions;
|
final PolygonOptions polygonOptions;
|
||||||
|
|
||||||
PolygonOptionsBuilder() {
|
PolygonOptionsBuilder() {
|
||||||
polygonOptions = new PolygonOptions();
|
polygonOptions = new PolygonOptions();
|
||||||
//必须设置为true,否则会出现线条转折处出现断裂的现象
|
//必须设置为true,否则会出现线条转折处出现断裂的现象
|
||||||
polygonOptions.usePolylineStroke(true);
|
polygonOptions.usePolylineStroke(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PolygonOptions build(){
|
public PolygonOptions build() {
|
||||||
return polygonOptions;
|
return polygonOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.amap.flutter.map.overlays.polygon;
|
package com.amap.flutter.map.overlays.polygon;
|
||||||
|
|
||||||
import com.amap.api.maps.model.AMapPara;
|
import com.amap.api.maps.model.AMapPara;
|
||||||
import com.amap.flutter.map.overlays.polyline.PolylineOptionsSink;
|
|
||||||
import com.amap.flutter.map.utils.ConvertUtil;
|
import com.amap.flutter.map.utils.ConvertUtil;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PolygonsController
|
||||||
@Override
|
@Override
|
||||||
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
||||||
String methodId = call.method;
|
String methodId = call.method;
|
||||||
LogUtil.i(CLASS_NAME, "doMethodCall===>" +methodId);
|
LogUtil.i(CLASS_NAME, "doMethodCall===>" + methodId);
|
||||||
switch (methodId) {
|
switch (methodId) {
|
||||||
case Const.METHOD_POLYGON_UPDATE:
|
case Const.METHOD_POLYGON_UPDATE:
|
||||||
invokePolylineOptions(call, result);
|
invokePolylineOptions(call, result);
|
||||||
|
@ -51,7 +51,6 @@ public class PolygonsController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param methodCall
|
* @param methodCall
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
||||||
class PolylineController implements PolylineOptionsSink {
|
class PolylineController implements PolylineOptionsSink {
|
||||||
final Polyline polyline;
|
final Polyline polyline;
|
||||||
final String polylineId;
|
final String polylineId;
|
||||||
|
|
||||||
PolylineController(Polyline polyline) {
|
PolylineController(Polyline polyline) {
|
||||||
this.polyline = polyline;
|
this.polyline = polyline;
|
||||||
this.polylineId = polyline.getId();
|
this.polylineId = polyline.getId();
|
||||||
|
@ -26,10 +27,11 @@ class PolylineController implements PolylineOptionsSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if(null != polyline) {
|
if (null != polyline) {
|
||||||
polyline.remove();
|
polyline.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPoints(List<LatLng> points) {
|
public void setPoints(List<LatLng> points) {
|
||||||
polyline.setPoints(points);
|
polyline.setPoints(points);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.amap.flutter.map.overlays.polyline;
|
package com.amap.flutter.map.overlays.polyline;
|
||||||
|
|
||||||
import com.amap.api.maps.model.AMapPara;
|
|
||||||
import com.amap.api.maps.model.BitmapDescriptor;
|
import com.amap.api.maps.model.BitmapDescriptor;
|
||||||
import com.amap.api.maps.model.LatLng;
|
import com.amap.api.maps.model.LatLng;
|
||||||
import com.amap.api.maps.model.PolylineOptions;
|
import com.amap.api.maps.model.PolylineOptions;
|
||||||
|
@ -95,7 +94,7 @@ class PolylineOptionsBuilder implements PolylineOptionsSink {
|
||||||
polylineOptions.lineJoinType(joinType);
|
polylineOptions.lineJoinType(joinType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PolylineOptions build(){
|
public PolylineOptions build() {
|
||||||
return polylineOptions;
|
return polylineOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PolylineUtil {
|
||||||
|
|
||||||
private static final String CLASS_NAME = "PolylineUtil";
|
private static final String CLASS_NAME = "PolylineUtil";
|
||||||
//虚线类型
|
//虚线类型
|
||||||
private static final int[] DASH_LINE_TYPE = {-1,0,1};
|
private static final int[] DASH_LINE_TYPE = {-1, 0, 1};
|
||||||
|
|
||||||
static String interpretOptions(Object o, PolylineOptionsSink sink) {
|
static String interpretOptions(Object o, PolylineOptionsSink sink) {
|
||||||
final Map<?, ?> data = ConvertUtil.toMap(o);
|
final Map<?, ?> data = ConvertUtil.toMap(o);
|
||||||
|
@ -60,7 +60,7 @@ class PolylineUtil {
|
||||||
if (rawType > DASH_LINE_TYPE.length) {
|
if (rawType > DASH_LINE_TYPE.length) {
|
||||||
rawType = 0;
|
rawType = 0;
|
||||||
}
|
}
|
||||||
if(DASH_LINE_TYPE[rawType] == -1) {
|
if (DASH_LINE_TYPE[rawType] == -1) {
|
||||||
sink.setDashLine(false);
|
sink.setDashLine(false);
|
||||||
} else {
|
} else {
|
||||||
sink.setDashLine(true);
|
sink.setDashLine(true);
|
||||||
|
@ -100,7 +100,7 @@ class PolylineUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String dartId = (String) data.get("id");
|
final String dartId = (String) data.get("id");
|
||||||
if(TextUtils.isEmpty(dartId)) {
|
if (TextUtils.isEmpty(dartId)) {
|
||||||
Log.w(CLASS_NAME, "没有传入正确的dart层ID, 请确认对应的key值是否正确!!!");
|
Log.w(CLASS_NAME, "没有传入正确的dart层ID, 请确认对应的key值是否正确!!!");
|
||||||
}
|
}
|
||||||
return dartId;
|
return dartId;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.text.TextUtils;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.AMap;
|
||||||
import com.amap.api.maps.TextureMapView;
|
|
||||||
import com.amap.api.maps.model.Polyline;
|
import com.amap.api.maps.model.Polyline;
|
||||||
import com.amap.api.maps.model.PolylineOptions;
|
import com.amap.api.maps.model.PolylineOptions;
|
||||||
import com.amap.flutter.map.MyMethodCallHandler;
|
import com.amap.flutter.map.MyMethodCallHandler;
|
||||||
|
@ -68,7 +67,6 @@ public class PolylinesController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param methodCall
|
* @param methodCall
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
|
@ -145,5 +143,4 @@ public class PolylinesController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import android.graphics.Point;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.AMap;
|
||||||
import com.amap.api.maps.CameraUpdate;
|
import com.amap.api.maps.CameraUpdate;
|
||||||
import com.amap.api.maps.CameraUpdateFactory;
|
import com.amap.api.maps.CameraUpdateFactory;
|
||||||
|
@ -28,8 +30,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import io.flutter.view.FlutterMain;
|
import io.flutter.view.FlutterMain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ import io.flutter.view.FlutterMain;
|
||||||
public class ConvertUtil {
|
public class ConvertUtil {
|
||||||
|
|
||||||
private static final String CLASS_NAME = "ConvertUtil";
|
private static final String CLASS_NAME = "ConvertUtil";
|
||||||
|
private static final int[] LocationTypeMap = new int[]{MyLocationStyle.LOCATION_TYPE_SHOW, MyLocationStyle.LOCATION_TYPE_FOLLOW, MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE};
|
||||||
public static float density;
|
public static float density;
|
||||||
private static String apiKey;
|
private static String apiKey;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ConvertUtil {
|
||||||
if (null != hasAgreeObj) {
|
if (null != hasAgreeObj) {
|
||||||
boolean hasAgree = toBoolean(hasAgreeObj);
|
boolean hasAgree = toBoolean(hasAgreeObj);
|
||||||
//使用反射的方法调用适配之前的版本
|
//使用反射的方法调用适配之前的版本
|
||||||
try{
|
try {
|
||||||
Method method = clazz.getMethod("updatePrivacyAgree", Context.class, boolean.class);
|
Method method = clazz.getMethod("updatePrivacyAgree", Context.class, boolean.class);
|
||||||
method.invoke(null, context, hasAgree);
|
method.invoke(null, context, hasAgree);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -138,7 +138,6 @@ public class ConvertUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Point toPoint(Object o) {
|
private static Point toPoint(Object o) {
|
||||||
final List<?> data = toList(o);
|
final List<?> data = toList(o);
|
||||||
return new Point(toPixels(data.get(0)), toPixels(data.get(1)));
|
return new Point(toPixels(data.get(0)), toPixels(data.get(1)));
|
||||||
|
@ -297,8 +296,6 @@ public class ConvertUtil {
|
||||||
return customMapStyleOptions;
|
return customMapStyleOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] LocationTypeMap = new int[]{MyLocationStyle.LOCATION_TYPE_SHOW, MyLocationStyle.LOCATION_TYPE_FOLLOW, MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE};
|
|
||||||
|
|
||||||
private static MyLocationStyle toMyLocationStyle(Object o, float density) {
|
private static MyLocationStyle toMyLocationStyle(Object o, float density) {
|
||||||
final Map<?, ?> map = toMap(o);
|
final Map<?, ?> map = toMap(o);
|
||||||
final MyLocationStyle myLocationStyle = new MyLocationStyle();
|
final MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||||
|
|
|
@ -10,29 +10,31 @@ import android.util.Log;
|
||||||
* @since
|
* @since
|
||||||
*/
|
*/
|
||||||
public class LogUtil {
|
public class LogUtil {
|
||||||
public static boolean isDebugMode = false;
|
|
||||||
private static final String TAG = "AMapFlutter_";
|
private static final String TAG = "AMapFlutter_";
|
||||||
|
public static boolean isDebugMode = false;
|
||||||
|
|
||||||
public static void i(String className, String message) {
|
public static void i(String className, String message) {
|
||||||
if(isDebugMode) {
|
if (isDebugMode) {
|
||||||
Log.i(TAG+className, message);
|
Log.i(TAG + className, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void d(String className, String message) {
|
public static void d(String className, String message) {
|
||||||
if(isDebugMode) {
|
if (isDebugMode) {
|
||||||
Log.d(TAG+className, message);
|
Log.d(TAG + className, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void w(String className, String message) {
|
public static void w(String className, String message) {
|
||||||
if(isDebugMode) {
|
if (isDebugMode) {
|
||||||
Log.w(TAG+className, message);
|
Log.w(TAG + className, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void e(String className, String methodName, Throwable e) {
|
public static void e(String className, String methodName, Throwable e) {
|
||||||
if (isDebugMode) {
|
if (isDebugMode) {
|
||||||
Log.e(TAG+className, methodName + " exception!!", e);
|
Log.e(TAG + className, methodName + " exception!!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 33
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
|
@ -35,7 +35,7 @@ android {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.amap.flutter.amap_map_example"
|
applicationId "com.amap.flutter.amap_map_example"
|
||||||
minSdkVersion flutter.minSdkVersion
|
minSdkVersion flutter.minSdkVersion
|
||||||
targetSdkVersion 29
|
targetSdkVersion 33
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
<!-- Flutter needs it to communicate with the running application
|
<!-- Flutter needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
-->
|
-->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -5,27 +5,28 @@
|
||||||
In most cases you can leave this as-is, but you if you want to provide
|
In most cases you can leave this as-is, but you if you want to provide
|
||||||
additional functionality it is fine to subclass or reimplement
|
additional functionality it is fine to subclass or reimplement
|
||||||
FlutterApplication and put your custom class here. -->
|
FlutterApplication and put your custom class here. -->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:label="amap_map_example"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:label="amap_map_example">
|
||||||
<!-- <meta-data
|
<!-- <meta-data
|
||||||
android:name="com.amap.api.v2.apikey"
|
android:name="com.amap.api.v2.apikey"
|
||||||
android:value="900f72eeee0f21e435cebb0ef155582a" /> -->
|
android:value="900f72eeee0f21e435cebb0ef155582a" /> -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTop"
|
|
||||||
android:theme="@style/LaunchTheme"
|
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/LaunchTheme"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
|
@ -33,8 +34,7 @@
|
||||||
to determine the Window background behind the Flutter UI. -->
|
to determine the Window background behind the Flutter UI. -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.embedding.android.NormalTheme"
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
android:resource="@style/NormalTheme"
|
android:resource="@style/NormalTheme" />
|
||||||
/>
|
|
||||||
<!-- Displays an Android View that continues showing the launch screen
|
<!-- Displays an Android View that continues showing the launch screen
|
||||||
Drawable until Flutter paints its first frame, then this splash
|
Drawable until Flutter paints its first frame, then this splash
|
||||||
screen fades out. A splash screen is useful to avoid any visual
|
screen fades out. A splash screen is useful to avoid any visual
|
||||||
|
@ -42,11 +42,10 @@
|
||||||
Flutter's first frame. -->
|
Flutter's first frame. -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||||
android:resource="@drawable/launch_background"
|
android:resource="@drawable/launch_background" />
|
||||||
/>
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
|
|
|
@ -3,4 +3,4 @@ package com.amap.flutter.amap_map_example;
|
||||||
import io.flutter.embedding.android.FlutterActivity;
|
import io.flutter.embedding.android.FlutterActivity;
|
||||||
|
|
||||||
public class MainActivity extends FlutterActivity {
|
public class MainActivity extends FlutterActivity {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@android:color/white" />
|
<item android:drawable="@android:color/white" />
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
<!-- Flutter needs it to communicate with the running application
|
<!-- Flutter needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
-->
|
-->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue