切换地图的逻辑修改
This commit is contained in:
@@ -19,11 +19,7 @@ class AMapViewHandler {
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
} else {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.impl.amap.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 java.util.HashSet;
|
||||
@@ -28,7 +29,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
private static final String TAG = "LocationClient";
|
||||
private final Context mContext;
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
private AMapLocationListener mListener = new InternalLocationListener();
|
||||
|
||||
@@ -76,28 +76,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.unRegisterLocationListener( mListener );
|
||||
mClient.stopLocation();
|
||||
@@ -142,8 +122,9 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
}
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromAMap( aMapLocation );
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
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;
|
||||
@@ -64,7 +65,6 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
@@ -249,9 +249,7 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
if ( mAMapNaviListener != null ) {
|
||||
mAMapNaviListener.setLineClickInteraction( lineClickInteraction );
|
||||
}
|
||||
// do not impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -303,15 +301,16 @@ 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 );
|
||||
mCarLocation = location;
|
||||
if ( MogoCarLocationChangedListenerRegister.getInstance().getListener() != null ) {
|
||||
MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2( location );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,12 +267,6 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.setLineClickInteraction( lineClickInteraction );
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCalculatePaths() {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.map.impl.amap.R;
|
||||
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoOperationListenerRegister;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -64,7 +65,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
|
||||
private int mSelectedPathId;
|
||||
private CalculatePathItem mSelectedCalculatePathItem;
|
||||
private OnCalculatePathItemClickInteraction mLineClickInteraction;
|
||||
|
||||
/**
|
||||
* 起点终点marker
|
||||
@@ -299,8 +299,8 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( mPaths != null && !mPaths.isEmpty() ) {
|
||||
for ( MogoCalculatePath path : mPaths ) {
|
||||
if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
|
||||
if ( mLineClickInteraction != null ) {
|
||||
mLineClickInteraction.onItemClicked( path.getTagId() );
|
||||
if ( MogoOperationListenerRegister.getInstance().getItemClickInteraction() != null ) {
|
||||
MogoOperationListenerRegister.getInstance().getItemClickInteraction().onItemClicked( path.getTagId() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -440,10 +440,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
mLineClickInteraction = lineClickInteraction;
|
||||
}
|
||||
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( bounds != null ) {
|
||||
mBoundRect = bounds;
|
||||
|
||||
Reference in New Issue
Block a user