切换地图的逻辑修改
This commit is contained in:
@@ -203,7 +203,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mMapView != null) {
|
||||
// mMapView.onResume();
|
||||
mMapView.onResume();
|
||||
Logger.d(TAG, "map onResume");
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mMapView != null) {
|
||||
// mMapView.onPause();
|
||||
mMapView.onPause();
|
||||
Logger.d(TAG, "map onPause");
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setTraffic(visible);
|
||||
//mMapView.getMapAutoViewHelper().setTraffic(visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.IMogoMapViewCreator;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
@@ -14,21 +15,22 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapBaseMapView implements IMogoMapViewCreator {
|
||||
public class CustomMapView implements IMogoMapViewCreator {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
private MapAutoView mapAutoView;
|
||||
private static IMogoMapView mapView;
|
||||
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( DebugConfig.isDebug() )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) );
|
||||
mapAutoView = new MapAutoView( context );
|
||||
return new AMapViewWrapper( mapAutoView );
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
mapView = new AMapViewWrapper( mapAutoView );
|
||||
return mapView;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
@@ -27,7 +28,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
private static final String TAG = "LocationClient";
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
private LocationListener mListener = new InternalLocationListener();
|
||||
|
||||
@@ -79,28 +79,12 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,10 +99,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
mIsDestroyed = true;
|
||||
if ( sListeners != null ) {
|
||||
sListeners.clear();
|
||||
}
|
||||
sListeners = null;
|
||||
if ( mClient != null ) {
|
||||
mClient.unRegisterListener( mListener );
|
||||
mClient.destory();
|
||||
@@ -130,7 +110,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
private class InternalLocationListener implements LocationListener {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
|
||||
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
@@ -140,10 +120,11 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
location.getLon() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection("timer.onLocationChanged");
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromLocation( location );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||
synchronized ( listeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = listeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
@@ -62,7 +63,6 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation = new Location("GPS");
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
@@ -217,9 +217,7 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.setLineClickInteraction( lineClickInteraction );
|
||||
// }
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,15 +266,15 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
// -- end
|
||||
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
if ( MogoCarLocationChangedListenerRegister.getInstance().getListener() != null ) {
|
||||
MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2( location );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user