This commit is contained in:
wangcongtao
2020-10-22 14:17:12 +08:00
1425 changed files with 31249 additions and 12020 deletions

View File

@@ -66,12 +66,23 @@ class MogoMapDelegateFactory {
return AMapUIController.getInstance();
}
public static IMogoMapViewCreator getMapViewCreatorDelegate() {
private static IMogoMapView sMapView;
public static void createMapView( Context context ) {
if ( DebugConfig.isUseCustomMap() ) {
Logger.d( TAG, "use custom IMogoMapViewCreator" );
return new com.mogo.map.impl.custom.AMapBaseMapView();
sMapView = new com.mogo.map.impl.custom.AMapBaseMapView().create( context );
} else {
sMapView = new AMapBaseMapView().create( context );
}
return new AMapBaseMapView();
}
public static void destroy() {
sMapView = null;
}
public static IMogoMapView getMapView() {
return sMapView;
}
public static IMogoNavi getNaviDelegate( Context context ) {

View File

@@ -6,7 +6,6 @@ import android.util.AttributeSet;
import androidx.annotation.Nullable;
import com.mogo.map.impl.amap.AMapBaseMapView;
import com.mogo.utils.logger.Logger;
/**
@@ -18,6 +17,7 @@ import com.mogo.utils.logger.Logger;
public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
private static final String TAG = "MogoMapView";
public MogoMapView( Context context ) {
super( context );
}
@@ -30,40 +30,40 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
super( context, attrs, defStyleAttr );
}
@Override
protected IMogoMapView createMapView( Context context ) {
return MogoMapDelegateFactory.getMapViewCreatorDelegate().create( context );
}
@Override
public IMogoMap getMap() {
return super.getMap();
}
@Override
protected IMogoMapView createMapView( Context context ) {
MogoMapDelegateFactory.createMapView( context );
return MogoMapDelegateFactory.getMapView();
}
@Override
public void onCreate( Bundle bundle ) {
super.onCreate( bundle );
Logger.d(TAG,"onCreate");
Logger.d( TAG, "onCreate" );
}
@Override
public void onResume() {
super.onResume();
Logger.d(TAG,"onResume");
Logger.d( TAG, "onResume" );
}
@Override
public void onPause() {
super.onPause();
Logger.d(TAG,"onPause");
Logger.d( TAG, "onPause" );
}
@Override
public void onDestroy() {
super.onDestroy();
Logger.d(TAG,"onDestroy");
Logger.d( TAG, "onDestroy" );
}

View File

@@ -0,0 +1,49 @@
package com.mogo.map;
import android.content.Context;
import com.mogo.map.impl.amap.AMapViewHandler;
public
/**
* @author congtaowang
* @since 2020/9/10
*
* 描述
*/
class MogoMapViewInstanceHandler implements IMogoMapViewInstanceHandler {
private static volatile MogoMapViewInstanceHandler sInstance;
private MogoMapViewInstanceHandler(){}
public static MogoMapViewInstanceHandler getInstance(){
if( sInstance == null ){
synchronized( MogoMapViewInstanceHandler.class ) {
if( sInstance == null ){
sInstance = new MogoMapViewInstanceHandler();
}
}
}
return sInstance;
}
public synchronized void release(){
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
@Override
public void createMapViewInstance( Context context ) {
AMapViewHandler.createMapView( context );
}
@Override
public void destroy() {
AMapViewHandler.destroy();
}
}