|
|
|
|
@@ -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();
|
|
|
|
|
|