Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0

This commit is contained in:
董宏宇
2020-02-17 18:30:31 +08:00
6 changed files with 69 additions and 44 deletions

2
.idea/misc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -29,14 +29,16 @@ dependencies {
api rootProject.ext.dependencies.amapnavi3dmap
api rootProject.ext.dependencies.amapsearch
api rootProject.ext.dependencies.amaplocation
compile project(path: ':foudations:mogo-commons')
if (Boolean.valueOf(RELEASE)) {
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogomapapi
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':foudations:mogo-utils')
implementation project(':libraries:mogo-map-api')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -141,7 +141,7 @@ public class NaviClient implements IMogoNavi {
return;
}
// 关闭巡航
mAMapNavi.stopAimlessMode();
//mAMapNavi.stopAimlessMode();
mIsRealNavi = isRealNavi;
mAMapNavi.startNavi( isRealNavi ? NaviType.GPS : NaviType.EMULATOR );
}

View File

@@ -121,4 +121,12 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
getActivity().onBackPressed();
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if ( mPresenter != null ) {
mPresenter.onDestroy( getViewLifecycleOwner() );
}
}
}

View File

@@ -1,11 +1,22 @@
package com.mogo.module.apps;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.module.apps.utils.LaunchUtils;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.utils.TipToast;
import org.json.JSONException;
import org.json.JSONObject;
/**
* @author congtaowang
@@ -13,7 +24,9 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
* <p>
* 描述
*/
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoVoiceCmdCallBack {
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoIntentListener {
IMogoIntentManager mIntentManager;
public AppNavigatorPresenter( AppNavigatorView view ) {
super( view );
@@ -22,59 +35,55 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
mIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( getContext() );
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( AppsConst.CMD_OPEN_APPS_PANEL, AppsConst.CMD_OPEN_APPS_PANEL_UN_WAKEUP_WORDS, this );
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( AppsConst.CMD_CLOSE_APPS_PANEL, AppsConst.CMD_CLOSE_APPS_PANEL_UN_WAKEUP_WORDS, this );
mIntentManager.registerIntentListener( AppsConst.COMMAND_OPERATION, this );
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( AppsConst.CMD_OPEN_APPS_PANEL );
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( AppsConst.CMD_CLOSE_APPS_PANEL );
mIntentManager.unregisterIntentListener( AppsConst.COMMAND_OPERATION );
}
@Override
public void onCmdSelected( String cmd ) {
if ( mView == null ) {
public void onIntentReceived( String intentStr, Intent intent ) {
if ( !AppsConst.COMMAND_OPERATION.equals( intentStr ) ) {
return;
}
switch ( cmd ) {
case AppsConst.CMD_OPEN_APPS_PANEL:
mView.openAppsPanel();
break;
case AppsConst.CMD_CLOSE_APPS_PANEL:
mView.closeAppsPanel();
break;
try {
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
String app = object.optString( "object" );
String operation = object.optString( "operation" );
if ( AppsConst.OBJECT_ALL_APPS.equals( app ) ) {
if ( AppsConst.OPERATION_OPEN.equals( operation ) ) {
mView.openAppsPanel();
} else if ( AppsConst.OPERATION_CLOSE.equals( operation ) ) {
mView.closeAppsPanel();
}
} else if ( AppsConst.OBJECT_FAST_SETTINGS.equals( app ) ) {
if ( AppsConst.OPERATION_OPEN.equals( operation ) ) {
try {
LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_CAR_SETTINGS );
} catch ( Exception e ) {
TipToast.shortTip( R.string.module_apps_str_no_app );
}
}
}
} catch ( JSONException e ) {
e.printStackTrace();
}
}
@Override
public void onCmdAction( String speakText ) {
}
@Override
public void onCmdCancel( String speakText ) {
}
@Override
public void onSpeakEnd( String speakText ) {
}
@Override
public void onSpeakSelectTimeOut( String speakText ) {
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
if ( mIntentManager != null ) {
mIntentManager.unregisterIntentListener( AppsConst.COMMAND_OPERATION );
}
super.onDestroy( owner );
}
}

View File

@@ -8,17 +8,16 @@ package com.mogo.module.apps;
*/
public class AppsConst {
/**
* 打开/关闭全部应用、打开/关闭车辆设置
*/
public static final String COMMAND_OPERATION = "system.application.operation";
/**
* 每页显示多少个app
*/
public static final int TOTAL_SIZE_EACH_PAGE = 12;
public static final String CMD_OPEN_APPS_PANEL = "CMD_OPEN_APPS_PANEL";
public static final String[] CMD_OPEN_APPS_PANEL_UN_WAKEUP_WORDS = {"打开全部应用"};
public static final String CMD_CLOSE_APPS_PANEL = "CMD_CLOSE_APPS_PANEL";
public static final String[] CMD_CLOSE_APPS_PANEL_UN_WAKEUP_WORDS = {"关闭全部应用"};
/**
* 媒体跳转
*/
@@ -27,4 +26,11 @@ public class AppsConst {
* 车辆设置跳转
*/
public static final String APP_PKG_CAR_SETTINGS = "com.zhidao.settings";
public static final String OBJECT_ALL_APPS = "全部应用";
public static final String OBJECT_FAST_SETTINGS = "快捷设置";
public static final String OPERATION_OPEN = "打开";
public static final String OPERATION_CLOSE = "关闭";
}