This commit is contained in:
wangcongtao
2020-04-16 17:18:44 +08:00
parent 48ee99730e
commit c8cf947075
13 changed files with 275 additions and 246 deletions

View File

@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleProvider;
@@ -26,7 +27,7 @@ public interface MogoModulesHandler extends IMogoMapListener,
IMogoLocationListener,
IMogoMarkerClickListener,
IMogoAimlessModeListener,
IMogoCarLocationChangedListener {
IMogoCarLocationChangedListener2 {
/**
* 地图加载完成回调

View File

@@ -2,6 +2,7 @@ package com.mogo.module.main.cards;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.text.TextUtils;
import android.view.MotionEvent;
@@ -17,6 +18,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.IMogoNaviListener2;
import com.mogo.map.navi.MogoCongestionInfo;
@@ -109,7 +111,7 @@ public class MogoModulesManager implements MogoModulesHandler,
final List< MogoModule > modules = MogoModulePaths.getModules();
if ( modules != null && !modules.isEmpty() ) {
for ( MogoModule module : modules ) {
Logger.d(TAG,"module.getPath():" + module.getPath() + " name: " + module.getName());
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
IMogoModuleProvider provider = load( module.getPath() );
if ( provider != null ) {
mModuleProviders.put( module, provider );
@@ -655,15 +657,30 @@ public class MogoModulesManager implements MogoModulesHandler,
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
// do nothing.
}
@Override
public void onCarLocationChanged2( Location latLng ) {
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
if ( iterator == null ) {
return;
}
MogoLatLng target = null;
while ( iterator.hasNext() ) {
IMogoCarLocationChangedListener listener = iterator.next();
if ( listener != null ) {
if ( listener instanceof IMogoCarLocationChangedListener ) {
try {
listener.onCarLocationChanged( latLng );
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
} catch ( Exception e ) {
e.printStackTrace();
}
} else {
try {
if ( target == null ) {
target = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
}
listener.onCarLocationChanged( target );
} catch ( Exception e ) {
e.printStackTrace();
}