dev
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user