优化模块依赖

This commit is contained in:
wangcongtao
2020-11-20 17:42:37 +08:00
parent 832d87ec4b
commit cd37051d1d
13 changed files with 55 additions and 37 deletions

View File

@@ -1,14 +0,0 @@
package com.mogo.module.back;
/**
* @author congtaowang
* @since 2020-02-26
* <p>
* 描述
*/
public class BackToLauncherConst {
public static final String MODULE_NAME ="MOGO_BACK_2_LAUNCHER";
public static final String MODULE_PATH = "/back2launcher/ui";
}

View File

@@ -9,6 +9,8 @@ import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
@@ -18,7 +20,7 @@ import com.mogo.service.module.ModuleType;
* <p>
* 描述
*/
@Route( path = BackToLauncherConst.MODULE_PATH )
@Route( path = MogoServicePaths.PATH_BACK )
public class BackToLauncherModuleProvider implements IMogoModuleProvider {
private static final String TAG = "BackToLauncherModuleProvider";
@@ -36,7 +38,7 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
@NonNull
@Override
public String getModuleName() {
return BackToLauncherConst.MODULE_NAME;
return TAG;
}
@Override

View File

@@ -278,7 +278,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
mServiceApis.getAdasControllerApi().showADAS();
}
mServiceApis.getLauncherApi().setFloatButtonVisible( false );
if ( mServiceApis.getLauncherApi() != null ) {
mServiceApis.getLauncherApi().setFloatButtonVisible( false );
}
}
@Override
@@ -290,7 +292,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
if ( shouldCloseADASPanelWhenPause() ) {
mServiceApis.getAdasControllerApi().closeADAS();
}
mServiceApis.getLauncherApi().setFloatButtonVisible( true );
if ( mServiceApis.getLauncherApi() != null ) {
mServiceApis.getLauncherApi().setFloatButtonVisible( true );
}
}
protected boolean shouldCloseADASPanelWhenPause() {

View File

@@ -112,7 +112,9 @@ public class SchemeIntent implements IMogoStatusChangedListener {
delay = 5_000L;
}
mNextIntent = new IntentWrapper(intent, delay);
mApis.getLauncherApi().backToLauncher(mContext);
if ( mApis.getLauncherApi() != null ) {
mApis.getLauncherApi().backToLauncher(mContext);
}
return;
}

View File

@@ -117,7 +117,9 @@ public class MapPresenter extends Presenter< MapView > implements
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
UiThreadHandler.removeCallbacks( mLockCarRunnable );
} else {
mLauncher.backToLauncher( getContext() );
if ( mLauncher != null ) {
mLauncher.backToLauncher( getContext() );
}
UiThreadHandler.postDelayed( () -> {
try {
mStatusManager.setDisplayOverview( TAG, false );
@@ -136,7 +138,9 @@ public class MapPresenter extends Presenter< MapView > implements
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
return;
}
mLauncher.backToLauncher( getContext() );
if ( mLauncher != null ) {
mLauncher.backToLauncher( getContext() );
}
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() && !mStatusManager.isSearchUIShow() ) {
mSearchManager.showSearch();
}
@@ -148,7 +152,9 @@ public class MapPresenter extends Presenter< MapView > implements
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
return;
}
mLauncher.backToLauncher( getContext() );
if ( mLauncher != null ) {
mLauncher.backToLauncher( getContext() );
}
mMogoSearchManager.calculatePath( new MogoLatLng( lat, lon ) );
}
@@ -158,7 +164,9 @@ public class MapPresenter extends Presenter< MapView > implements
// 导航过程中语音指令退出导航,会出现 activity 不走 onResume 的情况
UiThreadHandler.postDelayed( () -> {
if ( AppUtils.isAppForeground( getContext() ) && !hasOthersActivity() && !mStatusManager.isMainPageOnResume() ) {
mLauncher.backToLauncher( getContext() );
if ( mLauncher != null ) {
mLauncher.backToLauncher( getContext() );
}
}
}, 500L );
return;
@@ -203,7 +211,9 @@ public class MapPresenter extends Presenter< MapView > implements
mView.getUIController().displayOverview( mDisplayOverviewBounds );
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
} else {
mLauncher.backToLauncher( getContext() );
if ( mLauncher != null ) {
mLauncher.backToLauncher( getContext() );
}
UiThreadHandler.postDelayed( () -> {
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );

View File

@@ -171,7 +171,6 @@ public class MogoServices implements IMogoMapListener,
private IMogoIntentManager mIntentManager;
private IMogoActionManager mActionManager;
private IMogoADASController mADASController;
private IMogoLauncher mLauncher;
private IMogoFragmentManager mFragmentManager;
private IMogoNavi mNavi;
private IMogoRegisterCenter mRegisterCenter;
@@ -557,7 +556,6 @@ public class MogoServices implements IMogoMapListener,
mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
mADASController = MarkerServiceHandler.getADASController();
mLauncher = MarkerServiceHandler.getLauncher();
mFragmentManager = MarkerServiceHandler.getFragmentManager();
mFragmentManager.addMainFragmentStackTransactionListener(this);

View File

@@ -22,7 +22,9 @@ public class MyLocationHandler implements IntentHandler {
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
MarkerServiceHandler.getMapUIController().recoverLockMode();
} else {
MarkerServiceHandler.getLauncher().backToLauncher( context );
if ( MarkerServiceHandler.getLauncher() != null ) {
MarkerServiceHandler.getLauncher().backToLauncher( context );
}
UiThreadHandler.postDelayed( () -> {
MarkerServiceHandler.getMapUIController().recoverLockMode();
}, 2_000L );

View File

@@ -50,7 +50,9 @@ class WholeVoiceCommandIntentHandler implements IntentHandler {
}
switch ( command ) {
case ServiceConst.COMMAND_BACK:
MarkerServiceHandler.getLauncher().backToLauncher( context );
if ( MarkerServiceHandler.getLauncher() != null ) {
MarkerServiceHandler.getLauncher().backToLauncher( context );
}
break;
}
}

View File

@@ -227,7 +227,9 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
private void enterApp( Context context ) {
try {
if ( DebugConfig.isLauncher() ) {
MogoWidgetManger.getInstance().getApis().getLauncherApi().backToLauncher( context );
if ( MogoWidgetManger.getInstance().getApis().getLauncherApi() != null ) {
MogoWidgetManger.getInstance().getApis().getLauncherApi().backToLauncher( context );
}
} else {
LaunchUtils.launchByPkg( context, "com.mogo.launcher.app" );
}