代码整理
This commit is contained in:
@ -1,21 +1,21 @@
|
||||
group 'com.amap.flutter.amap_map'
|
||||
group 'com.amap.flutter.map'
|
||||
version '1.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.amap.flutter.amap_map">
|
||||
</manifest>
|
||||
<manifest package="com.amap.flutter.map"></manifest>
|
||||
|
@ -9,7 +9,6 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.flutter.map.utils.LogUtil;
|
||||
|
||||
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
|
||||
@ -23,10 +22,11 @@ public class AMapFlutterMapPlugin implements
|
||||
FlutterPlugin,
|
||||
ActivityAware {
|
||||
private static final String CLASS_NAME = "AMapFlutterMapPlugin";
|
||||
private FlutterPluginBinding pluginBinding;
|
||||
private static final String VIEW_TYPE = "com.amap.flutter.map";
|
||||
private Lifecycle lifecycle;
|
||||
|
||||
private static final String VIEW_TYPE = "com.amap.flutter.map";
|
||||
public AMapFlutterMapPlugin() {
|
||||
}
|
||||
|
||||
public static void registerWith(PluginRegistry.Registrar registrar) {
|
||||
LogUtil.i(CLASS_NAME, "registerWith=====>");
|
||||
@ -58,15 +58,11 @@ public class AMapFlutterMapPlugin implements
|
||||
}
|
||||
}
|
||||
|
||||
public AMapFlutterMapPlugin() {
|
||||
}
|
||||
|
||||
// FlutterPlugin
|
||||
|
||||
@Override
|
||||
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
|
||||
LogUtil.i(CLASS_NAME, "onAttachedToEngine==>");
|
||||
pluginBinding = binding;
|
||||
binding
|
||||
.getPlatformViewRegistry()
|
||||
.registerViewFactory(
|
||||
@ -85,7 +81,6 @@ public class AMapFlutterMapPlugin implements
|
||||
@Override
|
||||
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
|
||||
LogUtil.i(CLASS_NAME, "onDetachedFromEngine==>");
|
||||
pluginBinding = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.amap.flutter.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import com.amap.api.maps.AMapOptions;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
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.utils.LogUtil;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.flutter.plugin.common.BinaryMessenger;
|
||||
@ -67,7 +65,7 @@ class AMapOptionsBuilder implements AMapOptionsSink {
|
||||
&& anchorY <= 1.0
|
||||
&& anchorY >= 0) {
|
||||
|
||||
aMapPlatformView.getMapController().setScreenAnchor( anchorX, anchorY);
|
||||
aMapPlatformView.getMapController().setScreenAnchor(anchorX, anchorY);
|
||||
}
|
||||
|
||||
aMapPlatformView.getMapController().setMinZoomLevel(minZoomLevel);
|
||||
|
@ -42,18 +42,14 @@ public class AMapPlatformView
|
||||
PlatformView {
|
||||
private static final String CLASS_NAME = "AMapPlatformView";
|
||||
private final MethodChannel methodChannel;
|
||||
|
||||
private final Map<String, MyMethodCallHandler> myMethodCallHandlerMap;
|
||||
private MapController mapController;
|
||||
private MarkersController markersController;
|
||||
private PolylinesController polylinesController;
|
||||
private PolygonsController polygonsController;
|
||||
|
||||
private TextureMapView mapView;
|
||||
|
||||
private boolean disposed = false;
|
||||
|
||||
private final Map<String, MyMethodCallHandler> myMethodCallHandlerMap;
|
||||
|
||||
AMapPlatformView(int id,
|
||||
Context context,
|
||||
BinaryMessenger binaryMessenger,
|
||||
|
@ -23,6 +23,7 @@ class AMapPlatformViewFactory extends PlatformViewFactory {
|
||||
private static final String CLASS_NAME = "AMapPlatformViewFactory";
|
||||
private final BinaryMessenger binaryMessenger;
|
||||
private final LifecycleProvider lifecycleProvider;
|
||||
|
||||
AMapPlatformViewFactory(BinaryMessenger binaryMessenger,
|
||||
LifecycleProvider lifecycleProvider) {
|
||||
super(StandardMessageCodec.INSTANCE);
|
||||
@ -37,13 +38,13 @@ class AMapPlatformViewFactory extends PlatformViewFactory {
|
||||
try {
|
||||
ConvertUtil.density = context.getResources().getDisplayMetrics().density;
|
||||
params = (Map<String, Object>) args;
|
||||
LogUtil.i(CLASS_NAME,"create params==>" + params);
|
||||
LogUtil.i(CLASS_NAME, "create params==>" + params);
|
||||
if (params.containsKey("privacyStatement")) {
|
||||
ConvertUtil.setPrivacyStatement(context, params.get("privacyStatement"));
|
||||
}
|
||||
|
||||
Object options = ((Map<String, Object>) args).get("options");
|
||||
if(null != options) {
|
||||
if (null != options) {
|
||||
ConvertUtil.interpretAMapOptions(options, builder);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.amap.flutter.map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
|
||||
@ -14,10 +13,12 @@ import io.flutter.plugin.common.MethodChannel;
|
||||
*/
|
||||
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}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String[] getRegisterMethodIdArray();
|
||||
String[] getRegisterMethodIdArray();
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ import com.amap.flutter.map.utils.LogUtil;
|
||||
public class ProxyLifecycleProvider
|
||||
implements
|
||||
Application.ActivityLifecycleCallbacks,
|
||||
LifecycleOwner,
|
||||
LifecycleProvider {
|
||||
LifecycleOwner {
|
||||
private static final String CLASS_NAME = "ProxyLifecycleProvider";
|
||||
private final LifecycleRegistry lifecycle = new LifecycleRegistry(this);
|
||||
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.LatLngBounds;
|
||||
import com.amap.api.maps.model.MyLocationStyle;
|
||||
import com.amap.api.maps.model.MyTrafficStyle;
|
||||
|
||||
/**
|
||||
* @author whm
|
||||
|
@ -3,7 +3,6 @@ package com.amap.flutter.map.core;
|
||||
import android.graphics.Bitmap;
|
||||
import android.location.Location;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
@ -43,16 +42,15 @@ public class MapController
|
||||
AMap.OnMapClickListener,
|
||||
AMap.OnMapLongClickListener,
|
||||
AMap.OnPOIClickListener {
|
||||
private static final String CLASS_NAME = "MapController";
|
||||
private static boolean hasStarted = false;
|
||||
private final MethodChannel methodChannel;
|
||||
private final AMap amap;
|
||||
private final TextureMapView mapView;
|
||||
private MethodChannel.Result mapReadyResult;
|
||||
protected int[] myArray = {};
|
||||
|
||||
private static final String CLASS_NAME = "MapController";
|
||||
|
||||
private MethodChannel.Result mapReadyResult;
|
||||
private boolean mapLoaded = false;
|
||||
private boolean myLocationShowing = false;
|
||||
|
||||
public MapController(MethodChannel methodChannel, TextureMapView mapView) {
|
||||
this.methodChannel = methodChannel;
|
||||
@ -72,7 +70,6 @@ public class MapController
|
||||
return Const.METHOD_ID_LIST_FOR_MAP;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
||||
LogUtil.i(CLASS_NAME, "doMethodCall===>" + call.method);
|
||||
@ -89,61 +86,47 @@ public class MapController
|
||||
mapReadyResult = result;
|
||||
break;
|
||||
case Const.METHOD_MAP_SATELLITE_IMAGE_APPROVAL_NUMBER:
|
||||
if (null != amap) {
|
||||
result.success(amap.getSatelliteImageApprovalNumber());
|
||||
}
|
||||
result.success(amap.getSatelliteImageApprovalNumber());
|
||||
break;
|
||||
case Const.METHOD_MAP_CONTENT_APPROVAL_NUMBER:
|
||||
if (null != amap) {
|
||||
result.success(amap.getMapContentApprovalNumber());
|
||||
}
|
||||
result.success(amap.getMapContentApprovalNumber());
|
||||
break;
|
||||
case Const.METHOD_MAP_UPDATE:
|
||||
if (amap != null) {
|
||||
ConvertUtil.interpretAMapOptions(call.argument("options"), this);
|
||||
result.success(ConvertUtil.cameraPositionToMap(getCameraPosition()));
|
||||
}
|
||||
ConvertUtil.interpretAMapOptions(call.argument("options"), this);
|
||||
result.success(ConvertUtil.cameraPositionToMap(getCameraPosition()));
|
||||
break;
|
||||
case Const.METHOD_MAP_MOVE_CAMERA:
|
||||
if (null != amap) {
|
||||
final CameraUpdate cameraUpdate = ConvertUtil.toCameraUpdate(call.argument("cameraUpdate"));
|
||||
final Object animatedObject = call.argument("animated");
|
||||
final Object durationObject = call.argument("duration");
|
||||
final CameraUpdate cameraUpdate = ConvertUtil.toCameraUpdate(call.argument("cameraUpdate"));
|
||||
final Object animatedObject = call.argument("animated");
|
||||
final Object durationObject = call.argument("duration");
|
||||
|
||||
moveCamera(cameraUpdate, animatedObject, durationObject);
|
||||
}
|
||||
moveCamera(cameraUpdate, animatedObject, durationObject);
|
||||
break;
|
||||
case Const.METHOD_MAP_SET_RENDER_FPS:
|
||||
if (null != amap) {
|
||||
amap.setRenderFps((Integer) call.argument("fps"));
|
||||
result.success(null);
|
||||
}
|
||||
amap.setRenderFps((Integer) call.argument("fps"));
|
||||
result.success(null);
|
||||
break;
|
||||
case Const.METHOD_MAP_TAKE_SNAPSHOT:
|
||||
if (amap != null) {
|
||||
final MethodChannel.Result _result = result;
|
||||
amap.getMapScreenShot(new AMap.OnMapScreenShotListener() {
|
||||
@Override
|
||||
public void onMapScreenShot(Bitmap bitmap) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
byte[] byteArray = stream.toByteArray();
|
||||
bitmap.recycle();
|
||||
_result.success(byteArray);
|
||||
}
|
||||
final MethodChannel.Result _result = result;
|
||||
amap.getMapScreenShot(new AMap.OnMapScreenShotListener() {
|
||||
@Override
|
||||
public void onMapScreenShot(Bitmap bitmap) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
byte[] byteArray = stream.toByteArray();
|
||||
bitmap.recycle();
|
||||
_result.success(byteArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapScreenShot(Bitmap bitmap, int i) {
|
||||
@Override
|
||||
public void onMapScreenShot(Bitmap bitmap, int i) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case Const.METHOD_MAP_CLEAR_DISK:
|
||||
if (null != amap) {
|
||||
amap.removecache();
|
||||
result.success(null);
|
||||
}
|
||||
amap.removecache();
|
||||
result.success(null);
|
||||
break;
|
||||
default:
|
||||
LogUtil.w(CLASS_NAME, "onMethodCall not find methodId:" + call.method);
|
||||
@ -187,8 +170,6 @@ public class MapController
|
||||
}
|
||||
}
|
||||
|
||||
private boolean myLocationShowing = false;
|
||||
|
||||
@Override
|
||||
public void setMyLocationStyle(MyLocationStyle myLocationStyle) {
|
||||
if (null != amap) {
|
||||
|
@ -1,13 +1,8 @@
|
||||
package com.amap.flutter.map.overlays;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
@ -23,7 +18,8 @@ public abstract class AbstractOverlayController<T> {
|
||||
protected final Map<String, String> idMapByOverlyId;
|
||||
protected final MethodChannel methodChannel;
|
||||
protected final AMap amap;
|
||||
public AbstractOverlayController(MethodChannel methodChannel, AMap amap){
|
||||
|
||||
public AbstractOverlayController(MethodChannel methodChannel, AMap amap) {
|
||||
this.methodChannel = methodChannel;
|
||||
this.amap = amap;
|
||||
controllerMapByDartId = new HashMap<String, T>(12);
|
||||
|
@ -30,12 +30,17 @@ class MarkerController implements MarkerOptionsSink {
|
||||
}
|
||||
|
||||
public LatLng getPosition() {
|
||||
if(null != marker) {
|
||||
if (null != marker) {
|
||||
return marker.getPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(LatLng position) {
|
||||
marker.setPosition(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
marker.setAlpha(alpha);
|
||||
@ -71,11 +76,6 @@ class MarkerController implements MarkerOptionsSink {
|
||||
marker.setSnippet(snippet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(LatLng position) {
|
||||
marker.setPosition(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation) {
|
||||
marker.setRotateAngle(rotation);
|
||||
|
@ -2,7 +2,6 @@ package com.amap.flutter.map.overlays.marker;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.amap.flutter.map.overlays.marker.MarkerOptionsSink;
|
||||
import com.amap.flutter.map.utils.ConvertUtil;
|
||||
|
||||
import java.util.List;
|
||||
@ -53,7 +52,7 @@ public class MarkerUtil {
|
||||
}
|
||||
final Object rotation = data.get("rotation");
|
||||
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");
|
||||
if (visible != null) {
|
||||
@ -66,7 +65,7 @@ public class MarkerUtil {
|
||||
|
||||
final Object infoWindowEnable = data.get("infoWindowEnable");
|
||||
|
||||
if(infoWindowEnable != null) {
|
||||
if (infoWindowEnable != null) {
|
||||
sink.setInfoWindowEnable(ConvertUtil.toBoolean(infoWindowEnable));
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,10 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
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.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
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.overlays.AbstractOverlayController;
|
||||
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.LatLng;
|
||||
import com.amap.api.maps.model.Polygon;
|
||||
import com.amap.api.maps.model.PolygonOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -13,11 +12,12 @@ import java.util.List;
|
||||
* @mail hongming.whm@alibaba-inc.com
|
||||
* @since
|
||||
*/
|
||||
class PolygonController implements PolygonOptionsSink{
|
||||
class PolygonController implements PolygonOptionsSink {
|
||||
|
||||
private final Polygon polygon;
|
||||
private final String id;
|
||||
PolygonController(Polygon polygon){
|
||||
|
||||
PolygonController(Polygon polygon) {
|
||||
this.polygon = polygon;
|
||||
this.id = polygon.getId();
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.amap.flutter.map.overlays.polygon;
|
||||
|
||||
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.PolygonOptions;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.amap.flutter.map.overlays.polyline.PolylineOptionsSink;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -17,13 +14,14 @@ import java.util.List;
|
||||
*/
|
||||
class PolygonOptionsBuilder implements PolygonOptionsSink {
|
||||
final PolygonOptions polygonOptions;
|
||||
|
||||
PolygonOptionsBuilder() {
|
||||
polygonOptions = new PolygonOptions();
|
||||
//必须设置为true,否则会出现线条转折处出现断裂的现象
|
||||
polygonOptions.usePolylineStroke(true);
|
||||
}
|
||||
|
||||
public PolygonOptions build(){
|
||||
public PolygonOptions build() {
|
||||
return polygonOptions;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.amap.flutter.map.overlays.polygon;
|
||||
|
||||
import com.amap.api.maps.model.AMapPara;
|
||||
import com.amap.flutter.map.overlays.polyline.PolylineOptionsSink;
|
||||
import com.amap.flutter.map.utils.ConvertUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -37,7 +37,7 @@ public class PolygonsController
|
||||
@Override
|
||||
public void doMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
|
||||
String methodId = call.method;
|
||||
LogUtil.i(CLASS_NAME, "doMethodCall===>" +methodId);
|
||||
LogUtil.i(CLASS_NAME, "doMethodCall===>" + methodId);
|
||||
switch (methodId) {
|
||||
case Const.METHOD_POLYGON_UPDATE:
|
||||
invokePolylineOptions(call, result);
|
||||
@ -51,7 +51,6 @@ public class PolygonsController
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param methodCall
|
||||
* @param result
|
||||
*/
|
||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
||||
class PolylineController implements PolylineOptionsSink {
|
||||
final Polyline polyline;
|
||||
final String polylineId;
|
||||
|
||||
PolylineController(Polyline polyline) {
|
||||
this.polyline = polyline;
|
||||
this.polylineId = polyline.getId();
|
||||
@ -26,10 +27,11 @@ class PolylineController implements PolylineOptionsSink {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
if(null != polyline) {
|
||||
if (null != polyline) {
|
||||
polyline.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoints(List<LatLng> points) {
|
||||
polyline.setPoints(points);
|
||||
|
@ -1,6 +1,5 @@
|
||||
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.LatLng;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
@ -95,7 +94,7 @@ class PolylineOptionsBuilder implements PolylineOptionsSink {
|
||||
polylineOptions.lineJoinType(joinType);
|
||||
}
|
||||
|
||||
public PolylineOptions build(){
|
||||
public PolylineOptions build() {
|
||||
return polylineOptions;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class 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) {
|
||||
final Map<?, ?> data = ConvertUtil.toMap(o);
|
||||
@ -60,7 +60,7 @@ class PolylineUtil {
|
||||
if (rawType > DASH_LINE_TYPE.length) {
|
||||
rawType = 0;
|
||||
}
|
||||
if(DASH_LINE_TYPE[rawType] == -1) {
|
||||
if (DASH_LINE_TYPE[rawType] == -1) {
|
||||
sink.setDashLine(false);
|
||||
} else {
|
||||
sink.setDashLine(true);
|
||||
@ -100,7 +100,7 @@ class PolylineUtil {
|
||||
}
|
||||
|
||||
final String dartId = (String) data.get("id");
|
||||
if(TextUtils.isEmpty(dartId)) {
|
||||
if (TextUtils.isEmpty(dartId)) {
|
||||
Log.w(CLASS_NAME, "没有传入正确的dart层ID, 请确认对应的key值是否正确!!!");
|
||||
}
|
||||
return dartId;
|
||||
|
@ -5,7 +5,6 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
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.PolylineOptions;
|
||||
import com.amap.flutter.map.MyMethodCallHandler;
|
||||
@ -68,7 +67,6 @@ public class PolylinesController
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param methodCall
|
||||
* @param result
|
||||
*/
|
||||
@ -145,5 +143,4 @@ public class PolylinesController
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
@ -28,8 +30,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.flutter.view.FlutterMain;
|
||||
|
||||
/**
|
||||
@ -41,7 +41,7 @@ import io.flutter.view.FlutterMain;
|
||||
public class 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;
|
||||
private static String apiKey;
|
||||
|
||||
@ -72,7 +72,7 @@ public class ConvertUtil {
|
||||
if (null != hasAgreeObj) {
|
||||
boolean hasAgree = toBoolean(hasAgreeObj);
|
||||
//使用反射的方法调用适配之前的版本
|
||||
try{
|
||||
try {
|
||||
Method method = clazz.getMethod("updatePrivacyAgree", Context.class, boolean.class);
|
||||
method.invoke(null, context, hasAgree);
|
||||
} catch (Throwable e) {
|
||||
@ -119,8 +119,8 @@ public class ConvertUtil {
|
||||
return CameraUpdateFactory.newLatLngZoom(toLatLng(data.get(1)), toFloat(data.get(2)));
|
||||
case "scrollBy":
|
||||
return CameraUpdateFactory.scrollBy( //
|
||||
toFloatPixels(data.get(1)), //
|
||||
toFloatPixels(data.get(2)));
|
||||
toFloatPixels(data.get(1)), //
|
||||
toFloatPixels(data.get(2)));
|
||||
case "zoomBy":
|
||||
if (data.size() == 2) {
|
||||
return CameraUpdateFactory.zoomBy(toFloat(data.get(1)));
|
||||
@ -138,7 +138,6 @@ public class ConvertUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Point toPoint(Object o) {
|
||||
final List<?> data = toList(o);
|
||||
return new Point(toPixels(data.get(0)), toPixels(data.get(1)));
|
||||
@ -297,8 +296,6 @@ public class ConvertUtil {
|
||||
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) {
|
||||
final Map<?, ?> map = toMap(o);
|
||||
final MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||
|
@ -10,29 +10,31 @@ import android.util.Log;
|
||||
* @since
|
||||
*/
|
||||
public class LogUtil {
|
||||
public static boolean isDebugMode = false;
|
||||
private static final String TAG = "AMapFlutter_";
|
||||
public static boolean isDebugMode = false;
|
||||
|
||||
public static void i(String className, String message) {
|
||||
if(isDebugMode) {
|
||||
Log.i(TAG+className, message);
|
||||
if (isDebugMode) {
|
||||
Log.i(TAG + className, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(String className, String message) {
|
||||
if(isDebugMode) {
|
||||
Log.d(TAG+className, message);
|
||||
if (isDebugMode) {
|
||||
Log.d(TAG + className, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void w(String className, String message) {
|
||||
if(isDebugMode) {
|
||||
Log.w(TAG+className, message);
|
||||
if (isDebugMode) {
|
||||
Log.w(TAG + className, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void e(String className, String methodName, Throwable e) {
|
||||
if (isDebugMode) {
|
||||
Log.e(TAG+className, methodName + " exception!!", e);
|
||||
Log.e(TAG + className, methodName + " exception!!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user