release 1.0.0+5
This commit is contained in:
parent
cd017f876b
commit
58ac2bdf6f
|
@ -3,7 +3,6 @@ package com.amap.flutter.map;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.lifecycle.Lifecycle;
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
|
@ -43,12 +42,7 @@ public class AMapFlutterMapPlugin implements
|
||||||
VIEW_TYPE,
|
VIEW_TYPE,
|
||||||
new AMapPlatformViewFactory(
|
new AMapPlatformViewFactory(
|
||||||
registrar.messenger(),
|
registrar.messenger(),
|
||||||
new LifecycleProvider() {
|
() -> ((LifecycleOwner) activity).getLifecycle()));
|
||||||
@Override
|
|
||||||
public Lifecycle getLifecycle() {
|
|
||||||
return ((LifecycleOwner) activity).getLifecycle();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
} else {
|
} else {
|
||||||
registrar
|
registrar
|
||||||
.platformViewRegistry()
|
.platformViewRegistry()
|
||||||
|
@ -69,13 +63,7 @@ public class AMapFlutterMapPlugin implements
|
||||||
VIEW_TYPE,
|
VIEW_TYPE,
|
||||||
new AMapPlatformViewFactory(
|
new AMapPlatformViewFactory(
|
||||||
binding.getBinaryMessenger(),
|
binding.getBinaryMessenger(),
|
||||||
new LifecycleProvider() {
|
() -> lifecycle));
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public Lifecycle getLifecycle() {
|
|
||||||
return lifecycle;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.amap.flutter.map;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -46,7 +48,7 @@ class AMapOptionsBuilder implements AMapOptionsSink {
|
||||||
AMapPlatformView build(int id,
|
AMapPlatformView build(int id,
|
||||||
Context context,
|
Context context,
|
||||||
BinaryMessenger binaryMessenger,
|
BinaryMessenger binaryMessenger,
|
||||||
LifecycleProvider lifecycleProvider) {
|
LifecycleOwner lifecycleProvider) {
|
||||||
try {
|
try {
|
||||||
//iOS端没有放大缩小UI, Android端强制隐藏
|
//iOS端没有放大缩小UI, Android端强制隐藏
|
||||||
options.zoomControlsEnabled(false);
|
options.zoomControlsEnabled(false);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class AMapPlatformView
|
||||||
AMapPlatformView(int id,
|
AMapPlatformView(int id,
|
||||||
Context context,
|
Context context,
|
||||||
BinaryMessenger binaryMessenger,
|
BinaryMessenger binaryMessenger,
|
||||||
LifecycleProvider lifecycleProvider,
|
LifecycleOwner lifecycleProvider,
|
||||||
AMapOptions options) {
|
AMapOptions options) {
|
||||||
|
|
||||||
methodChannel = new MethodChannel(binaryMessenger, "amap_map_" + id);
|
methodChannel = new MethodChannel(binaryMessenger, "amap_map_" + id);
|
||||||
|
@ -76,28 +76,28 @@ public class AMapPlatformView
|
||||||
|
|
||||||
private void initMyMethodCallHandlerMap() {
|
private void initMyMethodCallHandlerMap() {
|
||||||
String[] methodIdArray = mapController.getRegisterMethodIdArray();
|
String[] methodIdArray = mapController.getRegisterMethodIdArray();
|
||||||
if (null != methodIdArray && methodIdArray.length > 0) {
|
if (null != methodIdArray) {
|
||||||
for (String methodId : methodIdArray) {
|
for (String methodId : methodIdArray) {
|
||||||
myMethodCallHandlerMap.put(methodId, mapController);
|
myMethodCallHandlerMap.put(methodId, mapController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
methodIdArray = markersController.getRegisterMethodIdArray();
|
methodIdArray = markersController.getRegisterMethodIdArray();
|
||||||
if (null != methodIdArray && methodIdArray.length > 0) {
|
if (null != methodIdArray) {
|
||||||
for (String methodId : methodIdArray) {
|
for (String methodId : methodIdArray) {
|
||||||
myMethodCallHandlerMap.put(methodId, markersController);
|
myMethodCallHandlerMap.put(methodId, markersController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
methodIdArray = polylinesController.getRegisterMethodIdArray();
|
methodIdArray = polylinesController.getRegisterMethodIdArray();
|
||||||
if (null != methodIdArray && methodIdArray.length > 0) {
|
if (null != methodIdArray) {
|
||||||
for (String methodId : methodIdArray) {
|
for (String methodId : methodIdArray) {
|
||||||
myMethodCallHandlerMap.put(methodId, polylinesController);
|
myMethodCallHandlerMap.put(methodId, polylinesController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
methodIdArray = polygonsController.getRegisterMethodIdArray();
|
methodIdArray = polygonsController.getRegisterMethodIdArray();
|
||||||
if (null != methodIdArray && methodIdArray.length > 0) {
|
if (null != methodIdArray) {
|
||||||
for (String methodId : methodIdArray) {
|
for (String methodId : methodIdArray) {
|
||||||
myMethodCallHandlerMap.put(methodId, polygonsController);
|
myMethodCallHandlerMap.put(methodId, polygonsController);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.amap.flutter.map;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
import com.amap.api.maps.model.CameraPosition;
|
import com.amap.api.maps.model.CameraPosition;
|
||||||
import com.amap.flutter.map.utils.ConvertUtil;
|
import com.amap.flutter.map.utils.ConvertUtil;
|
||||||
import com.amap.flutter.map.utils.LogUtil;
|
import com.amap.flutter.map.utils.LogUtil;
|
||||||
|
@ -22,10 +24,10 @@ import io.flutter.plugin.platform.PlatformViewFactory;
|
||||||
class AMapPlatformViewFactory extends PlatformViewFactory {
|
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 LifecycleOwner lifecycleProvider;
|
||||||
|
|
||||||
AMapPlatformViewFactory(BinaryMessenger binaryMessenger,
|
AMapPlatformViewFactory(BinaryMessenger binaryMessenger,
|
||||||
LifecycleProvider lifecycleProvider) {
|
LifecycleOwner lifecycleProvider) {
|
||||||
super(StandardMessageCodec.INSTANCE);
|
super(StandardMessageCodec.INSTANCE);
|
||||||
this.binaryMessenger = binaryMessenger;
|
this.binaryMessenger = binaryMessenger;
|
||||||
this.lifecycleProvider = lifecycleProvider;
|
this.lifecycleProvider = lifecycleProvider;
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.amap.flutter.map;
|
|
||||||
|
|
||||||
import androidx.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author whm
|
|
||||||
* @date 2020/11/8 6:17 PM
|
|
||||||
* @mail hongming.whm@alibaba-inc.com
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
public interface LifecycleProvider {
|
|
||||||
Lifecycle getLifecycle();
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: amap_map
|
name: amap_map
|
||||||
description: Amap SDK Flutter plugin
|
description: Amap SDK Flutter plugin
|
||||||
version: 1.0.0+4
|
version: 1.0.0+5
|
||||||
homepage: https://github.com/kuloud/amap_map
|
homepage: https://github.com/kuloud/amap_map
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -10,8 +10,8 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
# flutter_plugin_android_lifecycle: ^2.0.1
|
flutter_plugin_android_lifecycle: ^2.0.1
|
||||||
# meta: ^1.3.0
|
meta: ^1.3.0
|
||||||
plugin_platform_interface: ^2.0.0
|
plugin_platform_interface: ^2.0.0
|
||||||
stream_transform: ^2.0.0
|
stream_transform: ^2.0.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue