This commit is contained in:
wangcongtao
2020-10-26 14:52:23 +08:00
parent e3f303c2ca
commit 8cc40f1d79
18 changed files with 294 additions and 112 deletions

View File

@@ -55,7 +55,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-online-13'
implementation 'com.zhidaoauto.machine:map:1.0.0-online-14'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -23,7 +23,7 @@ public class CustomMapView implements IMogoMapViewCreator {
@Override
public IMogoMapView create( Context context ) {
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( DebugConfig.isDebug() )
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )

View File

@@ -36,47 +36,54 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
super( context, attrs, defStyleAttr );
}
private boolean mIsFirstDisplayVRMode = true;
private boolean mIsVrMode = false;
@Override
protected void addDleMaps() {
if ( !MogoMapDelegateFactory.isUseCustom() ) {
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
} else {
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mCustomMapView;
}
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
mCustomMapView.getMapView().setVisibility( View.GONE );
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
}
@Override
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
mIsVrMode = false;
mMapView = mAMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mAMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( AMapUIController.getInstance() );
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
mCustomMapView.onPause();
mCustomMapView.getMapView().setVisibility( View.GONE );
mAMapView.onResume();
@@ -85,19 +92,21 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
@Override
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
if ( mIsFirstDisplayVRMode ) {
mCustomMapView.onCreate( null );
mIsFirstDisplayVRMode = false;
}
mIsVrMode = true;
mMapView = mCustomMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mCustomMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance() );
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
mCustomMapView.onResume();
mCustomMapView.getMapView().setVisibility( View.VISIBLE );
mAMapView.onPause();
mAMapView.getMapView().setVisibility( View.GONE );
}
public boolean isVrMode() {
return mIsVrMode;
}
@Override
public void onCreate( Bundle bundle ) {
super.onCreate( bundle );