diff --git a/app/build.gradle b/app/build.gradle index 2cfe6a5847..fc622ba4c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -88,7 +88,6 @@ android { buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"' // 是否支持目的地导航策略 buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'true' - } // launcher app launcher { @@ -118,6 +117,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // f系列-分体机 f80x { @@ -136,6 +137,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // e系列,采用Launcher方案 e8xx { @@ -154,6 +157,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // 同上 em4 { @@ -172,6 +177,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // e系列-2+32,对标D系列2+32,采用独立app的形式 em3 { @@ -190,6 +197,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // e系列-1+16,对标D系列1+16,采用独立app形式 em1 { @@ -208,6 +217,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'false' } // d系列 d8xx { @@ -226,6 +237,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // d系列 2 + 32 d80x { @@ -244,6 +257,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // d系列 1+16 版本 d82x { @@ -262,6 +277,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } // 比亚迪 bydauto { @@ -280,6 +297,8 @@ android { buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'false' // 是否支持桌面卡片刷新 buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false' + // 是否基于地图 + buildConfigField 'boolean', 'IS_MAP_BASED', 'true' } qa { dimension "env" @@ -347,6 +366,7 @@ dependencies { implementation rootProject.ext.dependencies.mogomoduleback implementation rootProject.ext.dependencies.guideshow implementation rootProject.ext.dependencies.moduleextensions + implementation rootProject.ext.dependencies.modulemap } else { implementation project(':foudations:mogo-commons') implementation project(':modules:mogo-module-common') @@ -363,6 +383,7 @@ dependencies { implementation project(':modules:mogo-module-back') implementation project(':modules:mogo-module-guide') implementation project(':modules:mogo-module-extensions') + implementation project(':modules:mogo-module-map') } apply from: "./functions/perform.gradle" diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index dc3990cf79..1b82ce8c86 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -130,6 +130,7 @@ public class MogoApplication extends AbsMogoApplication { DebugConfig.setSupportedSearchDestinationOnlineCarList( BuildConfig.IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST ); DebugConfig.setScheduleCalculateNotHomeCompanyDistanceForPush( BuildConfig.IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH ); DebugConfig.setSupportLauncherCardRefreshStrategy( BuildConfig.IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY ); + DebugConfig.setMapBased( BuildConfig.IS_MAP_BASED ); } @Override @@ -142,7 +143,6 @@ public class MogoApplication extends AbsMogoApplication { super.init(); final IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); prepareBaseService( apis, 2_000L ); -// installSkinManager( this, apis ); } /** diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java index a65367ae5a..e5b431ce7b 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java @@ -295,4 +295,17 @@ public class DebugConfig { public static boolean isNeedRequestUserInfo() { return needRequestUserInfo; } + + /** + * 是否基于地图 + */ + private static boolean isMapBased = true; + + public static boolean isMapBased() { + return isMapBased; + } + + public static void setMapBased( boolean isMapBased ) { + DebugConfig.isMapBased = isMapBased; + } } diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 19a3d1ecf9..f2b1e6815d 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -439,9 +439,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public MapControlResult changeZoom( float zoom ) { Logger.d( TAG, "changeZoom %s", zoom ); - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } getMap().changeZoom( zoom ); return MapControlResult.SUCCESS; } @@ -520,9 +517,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, Logger.e( TAG, "latlng = null or is illegal" ); return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } loseLockMode(); if ( animate ) { mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) ); @@ -537,9 +531,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) { return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } if ( checkAMapView() ) { MyLocationStyle style = getMyLocationStyle(); if ( style == null ) { @@ -565,9 +556,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, if ( NaviClient.getInstance( getContext() ).isNaviing() ) { return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } if ( checkAMapView() ) { MyLocationStyle style = getMyLocationStyle(); if ( style == null ) { @@ -647,9 +635,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void recoverLockMode() { if ( checkAMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "锁车" ); mMapView.recoverLockMode(); changeMyLocationType2Follow(); @@ -659,9 +644,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void loseLockMode() { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "解锁锁车" ); mIsCarLocked = false; mockTouchEvent(); @@ -683,9 +665,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void setLockZoom( int var1 ) { if ( checkAMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 ); // mMapView.setLockZoom( var1 ); } @@ -787,9 +766,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void setPointToCenter( double mapCenterX, double mapCenterY ) { if ( checkAMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY ); AMapNaviViewOptions options = mMapView.getViewOptions(); options.setPointToCenter( mapCenterX, mapCenterY ); @@ -866,9 +842,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, return; } try { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition ); if ( !lockCarPosition ) { loseLockMode(); diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java index c512ab3eda..f081517786 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java @@ -204,7 +204,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onCreate( Bundle bundle ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); if ( mMapView != null ) { mMapView.onCreate( bundle ); Logger.d( TAG, "map onCreate" ); @@ -218,7 +217,6 @@ public class AMapViewWrapper implements IMogoMapView, public void onResume() { if ( mMapView != null ) { mMapView.onResume(); - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); Logger.d( TAG, "map onResume" ); } } @@ -352,9 +350,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public MapControlResult changeZoom( float zoom ) { Logger.d( TAG, "changeZoom %s", zoom ); - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } getMap().changeZoom( zoom ); return MapControlResult.SUCCESS; } @@ -403,9 +398,6 @@ public class AMapViewWrapper implements IMogoMapView, Logger.e( TAG, "latlng = null or is illegal" ); return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } loseLockMode(); if ( animate ) { mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) ); @@ -420,9 +412,6 @@ public class AMapViewWrapper implements IMogoMapView, if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) { return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } if ( checkMapView() ) { MyLocationStyle style = getMyLocationStyle(); if ( style == null ) { @@ -442,9 +431,6 @@ public class AMapViewWrapper implements IMogoMapView, if ( NaviClient.getInstance( getContext() ).isNaviing() ) { return; } - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } if ( checkMapView() ) { MyLocationStyle style = getMyLocationStyle(); if ( style == null ) { @@ -487,9 +473,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void recoverLockMode() { if ( checkMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "锁车" ); Location target = NaviClient.getInstance( getContext() ).getCarLocation2(); if ( target != null ) { @@ -528,9 +511,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void loseLockMode() { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "解锁锁车" ); MyLocationStyle style = getMyLocationStyle(); style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER ); @@ -554,9 +534,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void setLockZoom( int var1 ) { if ( checkMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 ); // mMapView.setLockZoom( var1 ); } @@ -656,9 +633,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void setPointToCenter( double mapCenterX, double mapCenterY ) { if ( checkMapView() ) { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY ); mMapView.getMap().setPointToCenter( ( ( int ) ( mapCenterX * WindowUtils.getScreenWidth( getContext() ) ) ), ( ( int ) ( mapCenterY * WindowUtils.getScreenHeight( getContext() ) ) ) ); @@ -734,9 +708,6 @@ public class AMapViewWrapper implements IMogoMapView, return; } try { - if ( DebugConfig.isDebug() ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); - } LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition ); if ( !lockCarPosition ) { loseLockMode(); diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java index 33d7bfff49..2d5737acc8 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java @@ -53,7 +53,6 @@ public class MogoMarkerManager implements IMogoMarkerManager { try { return MogoMap.getInstance().getMogoMap().addMarker( tag, options ); } catch ( Exception e ) { - Logger.e( TAG, Log.getStackTraceString( e ) ); return null; } } @@ -70,13 +69,11 @@ public class MogoMarkerManager implements IMogoMarkerManager { @Override public void removeMarkers( String tag ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); MogoMarkersHandler.getInstance().remove( tag ); } @Override public void removeMarkers() { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); MogoMarkersHandler.getInstance().removeAll(); } @@ -92,7 +89,6 @@ public class MogoMarkerManager implements IMogoMarkerManager { @Override public void removeMarkersExcept( String tag ) { - Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); MogoMarkersHandler.getInstance().deleteAllExcept( tag ); } diff --git a/modules/mogo-module-main/build.gradle b/modules/mogo-module-main/build.gradle index f5ebe77146..62b7e4e96a 100644 --- a/modules/mogo-module-main/build.gradle +++ b/modules/mogo-module-main/build.gradle @@ -46,7 +46,6 @@ dependencies { api rootProject.ext.dependencies.mogoutils api rootProject.ext.dependencies.mogocommons api rootProject.ext.dependencies.modulecommon - api rootProject.ext.dependencies.modulemap api rootProject.ext.dependencies.mogoserviceapi api rootProject.ext.dependencies.moduleservice compileOnly rootProject.ext.dependencies.skinsupport @@ -54,7 +53,6 @@ dependencies { api project(":foudations:mogo-utils") api project(":foudations:mogo-commons") api project(':modules:mogo-module-common') - api project(':modules:mogo-module-map') api project(':services:mogo-service-api') api project(':services:mogo-service') compileOnly project(':skin:mogo-skin-support') diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index c251ad3729..eae7c2e181 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -9,7 +9,6 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.context.ContextHolderUtil; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.mvp.MvpActivity; @@ -19,7 +18,6 @@ import com.mogo.map.location.MogoLocation; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.map.MapCenterPointStrategy; import com.mogo.module.common.map.Scene; @@ -27,10 +25,8 @@ import com.mogo.module.main.cards.MogoModulesManager; import com.mogo.module.main.service.MogoMainService; import com.mogo.module.main.windowview.FloatingViewHandler; import com.mogo.service.IMogoServiceApis; -import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.mogo.service.fragmentmanager.IMogoFragmentManager; -import com.mogo.service.map.IMogoMapService; import com.mogo.service.module.IMogoModuleProvider; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.skin.support.SkinMode; @@ -55,12 +51,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme protected static final String TAG = MainActivity.class.getSimpleName(); protected IMogoServiceApis mServiceApis; - protected IMogoMapService mMogoMapService; - protected IMogoMapUIController mMogoMapUIController; protected IMogoFragmentManager mMogoFragmentManager; protected IMogoStatusManager mMogoStatusManager; - // protected View mHeader; protected View mApps; protected View mEntrance; protected View mEventPanel; @@ -97,7 +90,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme getWindow().setBackgroundDrawable( null ); -// mHeader = findViewById( R.id.module_main_id_header_fragment_container ); mApps = findViewById( R.id.module_main_id_apps_fragment_container ); mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container ); mEventPanel = findViewById( R.id.module_main_id_event_panel_fragment_container ); @@ -117,7 +109,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme // 隐藏布局 protected void hideLayout() { -// mHeader.setVisibility( View.GONE ); mEntrance.setVisibility( View.GONE ); mEventPanel.setVisibility( View.GONE ); mFloatingLayout.setVisibility( View.GONE ); @@ -125,7 +116,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme // 显示布局 protected void showLayout() { -// mHeader.setVisibility( View.VISIBLE ); mEntrance.setVisibility( View.VISIBLE ); mEventPanel.setVisibility( View.VISIBLE ); mFloatingLayout.setVisibility( View.VISIBLE ); @@ -134,7 +124,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme @Override protected void onCreate( @Nullable Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); - ContextHolderUtil.holdContext(this); + ContextHolderUtil.holdContext( this ); mPresenter.postLoadModuleMsg(); } @@ -156,41 +146,32 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme MogoModulesManager.getInstance().init( this ); loadSplash(); - mMogoMapService = mServiceApis.getMapServiceApi(); - if ( mMogoMapService != null ) { - mMogoMapService.getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() ); - mMogoMapService.getHostListenerRegister().registerHostNaviListener( EventDispatchCenter.getInstance() ); - mMogoMapService.getHostListenerRegister().registerHostAimlessModeListener( EventDispatchCenter.getInstance() ); - mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this ); - } -// IMogoObuManager obuManager = mServiceApis.getObuManager(); -// if(obuManager!=null) { -// obuManager.registerObuDataChangedListener(EventDispatchCenter.getInstance()); -// } + + if ( DebugConfig.isMapBased() ) { + if ( mServiceApis.getMapServiceApi() != null ) { + mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() ); + mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener( EventDispatchCenter.getInstance() ); + mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener( EventDispatchCenter.getInstance() ); + mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener( this ); + } + } if ( DebugConfig.isSkinSupported() ) { initAdasControlStatusListener(); } - EventDispatchCenter.getInstance().setMapLoadedCallback( () -> { - Logger.d( TAG, "map loaded." + Thread.currentThread().getName() ); - // 右移地图中心点 - mMogoMapUIController = mMogoMapService.getMapUIController(); - MapCenterPointStrategy.init(); - MapCenterPointStrategy.setMapCenterPointByScene( mMogoMapUIController, Scene.AIMLESS ); - - // 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。 - loadContainerModules(); - MogoModulesManager.getInstance().loadModules(); - mPresenter.delayOperations(); - - // 启动一些基本的服务:定位等 - startBaseService(); - - Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); - } ); - MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container ); + if ( DebugConfig.isMapBased() ) { + EventDispatchCenter.getInstance().setMapLoadedCallback( () -> { + Logger.d( TAG, "map loaded." + Thread.currentThread().getName() ); + resetMapCenterPoint(); + loadOthersModules(); + Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + } ); + MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container ); + } else { + loadOthersModules(); + } mMogoFragmentManager = mServiceApis.getFragmentManagerApi(); mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment ); @@ -203,12 +184,25 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme } } ); - // 初始化MonitorModule -// IMogoMonitorProvider monitorProvider = (IMogoMonitorProvider) ARouter.getInstance().build(MogoServicePaths.PATH_MOGO_MONITOR).navigation(this); -// monitorProvider.resetActivityContext(this); mServiceApis.getMogoMonitorApi().resetActivityContext( this ); } + private void resetMapCenterPoint() { + // 右移地图中心点 + MapCenterPointStrategy.init(); + MapCenterPointStrategy.setMapCenterPointByScene( mServiceApis.getMapServiceApi().getMapUIController(), Scene.AIMLESS ); + } + + private void loadOthersModules() { + // 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。 + loadContainerModules(); + MogoModulesManager.getInstance().loadModules(); + mPresenter.delayOperations(); + + // 启动一些基本的服务:定位等 + startBaseService(); + } + private void initAdasControlStatusListener() { mServiceApis.getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this ); AdasConfigApiController.getInstance().registerAdasSettingUiListener( EventDispatchCenter.getInstance() ); @@ -230,6 +224,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme @Override public void hideCoverUpLayout() { + Logger.d( TAG, "隐藏遮罩" ); mCoverUpLayout.setVisibility( View.GONE ); mServiceApis.getAdasControllerApi().showADAS(); } @@ -347,13 +342,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme @Override protected void onDestroy() { super.onDestroy(); - mMogoMapService.getHostListenerRegister().unregisterMarkerClickListener(); - mMogoMapService.getHostListenerRegister().unregisterHostAimlessModeListener(); - mMogoMapService.getHostListenerRegister().unregisterHostNaviListener(); - mMogoMapService.getHostListenerRegister().unregisterHostMapListener(); + mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterMarkerClickListener(); + mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostAimlessModeListener(); + mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostNaviListener(); + mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostMapListener(); mMogoStatusManager.setMainPageLaunchedStatus( TAG, false ); - mMogoMapService = null; - mMogoMapUIController = null; mMogoFragmentManager.unregisterMainFragmentStackTransactionListener(); mMogoFragmentManager = null; mServiceApis.getMapServiceApi().getMapViewInstanceHandler().destroy(); diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml index 89e4866069..aa69eb8330 100644 --- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml +++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml @@ -79,8 +79,7 @@ android:layout_height="match_parent" android:scaleType="centerCrop" android:background="@drawable/main_bitmap_splash_bg" - android:visibility="visible" - /> + android:visibility="visible" />