This commit is contained in:
wangcongtao
2020-06-10 17:31:41 +08:00
parent aaf50f128f
commit 35a699d951
17 changed files with 74 additions and 10 deletions

View File

@@ -117,6 +117,9 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
@Override
public void renderUserInfo(UserInfo userInfo) {
Logger.d(TAG, "renderUserInfo: " + userInfo);
if ( userInfo == null ) {
return;
}
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).circleCrop().into(mUserHeadImg);
}
}

View File

@@ -391,10 +391,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (naviinfo == null) {
return;
}
if (mExitNavi.getVisibility() == View.GONE) {
// 避免先导航后启动app导致无法显示控件
onStartNavi();
}
mNaviInfo.notifyChanged(naviinfo);
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.gps.simulator;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoNavi;
@@ -17,6 +18,7 @@ import org.java_websocket.handshake.ServerHandshake;
import org.json.JSONObject;
import java.net.URI;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -101,6 +103,18 @@ public class WebSocketManager {
realTimeLocationVo.getDirection(),
realTimeLocationVo.getLocationTime()
);
Iterator< IMogoLocationListener > listeners = mServiceApis.getRegisterCenterApi().getLocationListeners();
MogoLocation location = new MogoLocation();
location.setLatitude( realTimeLocationVo.getLat() );
location.setLongitude( realTimeLocationVo.getLon() );
location.setSpeed( realTimeLocationVo.getVehicleSpeed() );
location.setAccuracy( 1 );
location.setTime( realTimeLocationVo.getLocationTime() );
if ( listeners != null ) {
while ( listeners.hasNext() ) {
listeners.next().onLocationChanged( location );
}
}
} );
}
}

View File

@@ -157,6 +157,7 @@ public class EventDispatchCenter implements
@Override
public void onCarLocationChanged2( Location latLng ) {
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
if ( iterator == null ) {
return;
@@ -370,7 +371,6 @@ public class EventDispatchCenter implements
public void onStartNavi() {
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if ( iterator == null ) {
return;
}
@@ -447,6 +447,7 @@ public class EventDispatchCenter implements
@Override
public void onLocationChanged( MogoLocation location ) {
final long start = System.currentTimeMillis();
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
if ( iterator == null ) {

View File

@@ -13,6 +13,9 @@ import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoRegisterCenter;
import java.util.Iterator;
import java.util.List;
/**
* @author congtaowang
* @since 2020-01-09
@@ -57,6 +60,11 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener( moduleName, listener );
}
@Override
public Iterator< IMogoLocationListener > getLocationListeners() {
return MogoRegisterCenterHandler.getInstance().getLocationListeners();
}
@Override
public void unregisterMogoLocationListener( String moduleName ) {
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener( moduleName );

View File

@@ -158,6 +158,7 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
return mNavi.values().iterator();
}
@Override
public Iterator< IMogoLocationListener > getLocationListeners() {
return mLocation.values().iterator();
}

View File

@@ -49,6 +49,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
Logger.d( TAG, "基本服务启动" );
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
initAndStartLocation();
initGpsSimulatorListener();
loadBaseModules();
startTanluService();
initADAS();
@@ -60,7 +61,9 @@ class MogoMainService extends Service implements IMogoLocationListener {
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
mLocationClient.addLocationListener( this );
mLocationClient.start( 2_000L );
}
private void initGpsSimulatorListener() {
mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
}
@@ -69,11 +72,11 @@ class MogoMainService extends Service implements IMogoLocationListener {
MogoModulesManager.getInstance().loadBaseModule();
}
private void startTanluService(){
private void startTanluService() {
MainService.Companion.launchService( getApplicationContext(), "0" );
}
private void initADAS(){
private void initADAS() {
mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
}

View File

@@ -54,6 +54,7 @@ dependencies {
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.gpssimulator
} else {
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
@@ -61,6 +62,7 @@ dependencies {
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-gps-simulator')
}
}

View File

@@ -11,6 +11,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager;
import com.mogo.module.service.marker.MapMarkerManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
@@ -60,6 +61,7 @@ public class MarkerServiceHandler {
private static IMogoLauncher sLauncher;
private static IMogoFragmentManager sFragmentManager;
private static ICarsChattingProvider sCarChatting;
private static IMogoGpsSimulatorManager sGpsSimulatorManager;
private static MapMarkerManager sMapMarkerManager;
@@ -87,6 +89,8 @@ public class MarkerServiceHandler {
sMapMarkerManager = MapMarkerManager.getInstance();
sMapMarkerManager.init( context );
sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
}
public static IMogoServiceApis getApis(){
@@ -169,6 +173,9 @@ public class MarkerServiceHandler {
return sCarChatting;
}
public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
return sGpsSimulatorManager;
}
//TODO -------------以下方法是临时过度使用的后面统一使用getMapMarkerManager进行调用

View File

@@ -70,7 +70,6 @@ public class MockIntentHandler implements IntentHandler {
button1.setVisibility( View.VISIBLE );
button1.setBackgroundColor( Color.RED );
button1.setOnClickListener( view -> {
TipToast.shortTip( "测试" );
} );
}
break;
@@ -276,11 +275,17 @@ public class MockIntentHandler implements IntentHandler {
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, options );
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( mogoLatLngs.get( 0 ) );
WorkThreadHandler.getInstance().post( ()->{
WorkThreadHandler.getInstance().post( () -> {
marker.startSmooth( mogoLatLngs, duration );
} );
}
break;
case 15:
MarkerServiceHandler.getGpsSimulatorManager().open();
break;
case 16:
MarkerServiceHandler.getGpsSimulatorManager().close();
break;
}
}
}