优化代码

This commit is contained in:
wangcongtao
2020-11-25 21:17:12 +08:00
parent 431a467ff4
commit e89d4058d2
15 changed files with 94 additions and 62 deletions

View File

@@ -86,7 +86,6 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) );
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare" ) );
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare" ) );
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_EVENT_PANEL, "EventPanel" ) );
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );

View File

@@ -154,7 +154,7 @@ ext {
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.5",
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5",
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5.2",
// 个人中心的SDK
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",

View File

@@ -460,9 +460,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
break;
case Type_Light:
options.setNaviNight( false );
options.setAutoNaviViewNightMode( false );
break;
case Type_Night:
options.setNaviNight( true );
options.setAutoNaviViewNightMode( false );
break;
case Type_AUTO_LIGHT_Night:
options.setNaviNight( false );

View File

@@ -66,15 +66,15 @@ class CallChatApi {
driverInfo.setSn( onlineCar.getUserInfo().getSn() );
driverInfo.setUserHead( onlineCar.getUserInfo().getUserHead() );
driverInfo.setUserName( onlineCar.getUserInfo().getUserName() );
mApiProvider.showUserWindow( TAG, driverInfo, context );
if ( mApiProvider != null ) {
mApiProvider.showUserWindow( TAG, driverInfo, context );
}
}
public void hideUserWindow( Context context ) {
if ( mApiProvider != null ) {
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
mApiProvider.hideUserWindow( TAG, context, null );
}

View File

@@ -112,7 +112,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
FloatingViewHandler.init( mFloatingLayout );
mServiceApis.getOnlineCarPanelApi().initContainer( R.id.module_main_id_message_history_fragment_container, this );
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
if ( CallChatApi.getInstance().getApiProvider() != null ) {
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
}
}
// 隐藏布局
@@ -368,7 +370,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
AIAssist.getInstance( this ).release();
mServiceApis.getOnlineCarPanelApi().clear();
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", 0, null);
if ( CallChatApi.getInstance().getApiProvider() != null ) {
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", 0, null);
}
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();
SchemeIntent.getInstance().clear();

View File

@@ -6,6 +6,7 @@ import android.content.Context;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.main.MainActivity;
@@ -127,9 +128,7 @@ public class MogoModulesManager implements MogoModulesHandler {
@Override
public void loadEventPanelModule( int containerId ) {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
.build( MogoServicePaths.PATH_EVENT_PANEL )
.navigation( getContext() );
IMogoModuleProvider provider = MogoApisHandler.getInstance().getApis().getEventPanelManager();
addFragment( provider, containerId );
}

View File

@@ -101,7 +101,9 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
}
}
};
ServiceMediaHandler.getCarsChattingApis().registerCallWindowStatusListener( MediaConstants.MODULE_TYPE, mContext, mCallProviderResponse);
if ( ServiceMediaHandler.getCarsChattingApis() != null ) {
ServiceMediaHandler.getCarsChattingApis().registerCallWindowStatusListener( MediaConstants.MODULE_TYPE, mContext, mCallProviderResponse);
}
isFirstPlay = true;
}
@@ -344,7 +346,9 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
public void onDestroy(){
Logger.d(TAG, "onDestroy");
ServiceMediaHandler.getCarsChattingApis().unRegisterCallWindowStatusListener( MediaConstants.MODULE_TYPE, mContext);
if ( ServiceMediaHandler.getCarsChattingApis() != null ) {
ServiceMediaHandler.getCarsChattingApis().unRegisterCallWindowStatusListener( MediaConstants.MODULE_TYPE, mContext);
}
ServiceMediaHandler.getIMogoStatusManager().unregisterStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.ACC_STATUS,this);
}
}

View File

@@ -412,7 +412,9 @@ public class MogoServices implements IMogoMapListener,
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSettingStatus(false);
MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel();
carsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
carsChattingProvider.hideUserWindow("MOGO_COMMON_SERVICE", mContext, mCallProviderResponse);
if ( carsChattingProvider != null ) {
carsChattingProvider.hideUserWindow("MOGO_COMMON_SERVICE", mContext, mCallProviderResponse);
}
}
public void init(Context context) {

View File

@@ -113,24 +113,26 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
if ( CallChatApi.getInstance().getApiProvider() != null ) {
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
@Override
public void userWindowStatus( boolean show ) {
try {
if ( mLastCheckMarker == null ) {
return;
@Override
public void userWindowStatus( boolean show ) {
try {
if ( mLastCheckMarker == null ) {
return;
}
if ( TextUtils.equals( mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA )
&& !show ) {
closeMarker( mLastCheckMarker );
}
} catch ( Exception e ) {
e.printStackTrace();
}
if ( TextUtils.equals( mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA )
&& !show ) {
closeMarker( mLastCheckMarker );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
} );
} );
}
}
/**

View File

@@ -194,7 +194,9 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
params.put( CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "" );
}
Logger.d( TAG, "call parameters: %s", params );
MarkerServiceHandler.getCarChatting().call( params );
if ( MarkerServiceHandler.getCarChatting() != null ) {
MarkerServiceHandler.getCarChatting().call( params );
}
}
protected void loadImageHeader( final MarkerShowEntity markerShowEntity ) {

View File

@@ -78,7 +78,9 @@ class OnlineCarPanelAdapter extends RecyclerView.Adapter<OnlineCarPanelAdapter.V
params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "");
params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "");
ICarsChattingProvider carChatting = MarkerServiceHandler.getCarChatting();
carChatting.call(params);
if ( carChatting != null ) {
carChatting.call(params);
}
});
}

View File

@@ -105,7 +105,9 @@ public abstract class V2XBaseViewHolder<T>
String name = noveltyInfo.getUserInfo().getUserName();
mogoDriverInfo.setUserName(name != null ? name : "");
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
if ( mCarsChattingProvider != null ) {
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
}
} catch (Exception e) {
Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e);

View File

@@ -125,7 +125,9 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mogoDriverInfo.setSn("12345678");
mogoDriverInfo.setUserName("测试");
mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543");
V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, context);
if ( V2XServiceManager.getCarsChattingProvider() != null ) {
V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, context);
}
});
mBtnTriggerOpen.setOnClickListener(v ->

View File

@@ -50,7 +50,9 @@ public class ChartingUtil {
}
Logger.d(MODULE_NAME, "调用车聊聊传入参数:\n" + params);
V2XServiceManager.getCarsChattingProvider().call(params);
if ( V2XServiceManager.getCarsChattingProvider() != null ) {
V2XServiceManager.getCarsChattingProvider().call(params);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -73,24 +75,26 @@ public class ChartingUtil {
} else {
Logger.d("", "不是我的分享");
}
V2XServiceManager.getCarsChattingProvider().isOnLine(
"CAR_CALL_TO_" + V2XConst.MODULE_NAME,
V2XUtils.getApp(),
sn,
new ICallChatResponse() {
@Override
public void refuse(boolean b, int i) {
if ( V2XServiceManager.getCarsChattingProvider() != null ) {
V2XServiceManager.getCarsChattingProvider().isOnLine(
"CAR_CALL_TO_" + V2XConst.MODULE_NAME,
V2XUtils.getApp(),
sn,
new ICallChatResponse() {
@Override
public void refuse(boolean b, int i) {
}
@Override
public void isOnLine(boolean onLine, @Nullable String errorMsg) {
Logger.e(V2XConst.MODULE_NAME, "isOnLine" + onLine + " errorMsg" + errorMsg);
if (chartStatusListener != null) {
chartStatusListener.canCall(onLine);
}
}
});
@Override
public void isOnLine(boolean onLine, @Nullable String errorMsg) {
Logger.e(V2XConst.MODULE_NAME, "isOnLine" + onLine + " errorMsg" + errorMsg);
if (chartStatusListener != null) {
chartStatusListener.canCall(onLine);
}
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -104,18 +108,20 @@ public class ChartingUtil {
*/
public static void isCanCall(ChartStatusListener chartStatusListener) {
try {
V2XServiceManager.getCarsChattingProvider().canCall(
"CAR_CALL_TO_" + V2XConst.MODULE_NAME,
V2XUtils.getApp(),
new ICallChatResponse() {
@Override
public void canCall(boolean onLine) {
Logger.e(V2XConst.MODULE_NAME, "isOnLine" + onLine);
if (chartStatusListener != null) {
chartStatusListener.canCall(onLine);
if ( V2XServiceManager.getCarsChattingProvider() != null ) {
V2XServiceManager.getCarsChattingProvider().canCall(
"CAR_CALL_TO_" + V2XConst.MODULE_NAME,
V2XUtils.getApp(),
new ICallChatResponse() {
@Override
public void canCall(boolean onLine) {
Logger.e(V2XConst.MODULE_NAME, "isOnLine" + onLine);
if (chartStatusListener != null) {
chartStatusListener.canCall(onLine);
}
}
}
});
});
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -250,9 +250,15 @@ public class MogoADASController implements IMogoADASController {
AdasConfigApiController.getInstance().setUserCarHeading( EnumCarHeading.NORTH_UP );
break;
case Type_Light:
if ( getCurrentSkinMode() == EnumMapUI.Type_Light ) {
return;
}
AdasConfigApiController.getInstance().setUserSkinModel( EnumSkinStyle.WHITE );
break;
case Type_Night:
if ( getCurrentSkinMode() == EnumMapUI.Type_Night ) {
return;
}
AdasConfigApiController.getInstance().setUserSkinModel( EnumSkinStyle.BLACK );
break;
case Type_AUTO_LIGHT_Night: