更改语音指令实现方式

This commit is contained in:
zhangyuanzhen
2020-02-03 17:30:30 +08:00
parent f41f2187bb
commit 933f93e4de
6 changed files with 485 additions and 88 deletions

View File

@@ -53,7 +53,6 @@ public class MapBroadCastHelper {
intent.putExtra("SOURCE_APP", context.getPackageName());
context.sendBroadcast(intent);
Log.v("MapBroadCastHelper","NavStatus="+status);
}
public void mapFrount(){

View File

@@ -1,6 +1,9 @@
package com.mogo.module.map;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.text.TextUtils;
@@ -13,6 +16,7 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.intent.IMogoIntentManager;
@@ -32,128 +36,190 @@ import java.util.Map;
* <p>
* 描述
*/
public class MapPresenter extends Presenter< MapView > implements
IMogoIntentListener,
IMogoVoiceCmdCallBack {
public class MapPresenter extends Presenter<MapView> implements
IMogoIntentListener,
IMogoVoiceCmdCallBack {
private static final String TAG = "MapPresenter";
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
"AUTONAVI_STANDARD_BROADCAST_RECV";
private IMogoMapService mMogoMapService;
private IMogoIntentManager mMogoIntentManager;
private IMogoSearchManager mSearchManager;
public MapPresenter( MapView view ) {
super( view );
public MapPresenter(MapView view) {
super(view);
initBroadcast();
}
/**
* opera type为00 实时路况开1实时路况关 type为10 放大地图; 1缩小地图 type为20切换2d车上 1切换2d北上2切换3d车上支持
*/
private void initBroadcast() {
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
int type = intent.getIntExtra("EXTRA_TYPE", -1);
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
Logger.d("NaviManager", "key_type" + key_type, null);
if (key_type == 10027) {
if (type == 0) {
mView.getUIController().setTrafficEnabled(opera_type == 0);
} else if (type == 1) {
mView.getUIController().changeZoom(opera_type == 0);
} else if (type == 2) {
if (opera_type == 0) {
mView.getUIController().changeMapMode(EnumMapUI.CarUp_2D);
} else if (opera_type == 1) {
mView.getUIController().changeMapMode(EnumMapUI.NorthUP_2D);
} else if (opera_type == 2) {
mView.getUIController().changeMapMode(EnumMapUI.CarUp_3D);
}
}
} else if (key_type == 10048) {
//* @param type 0:自动; 1白天; 2黑夜
int day_night_mode = intent.getIntExtra("EXTRA_DAY_NIGHT_MODE", -1);
if (day_night_mode == 0) {
mView.getUIController().changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night);
} else if (day_night_mode == 1) {
mView.getUIController().changeMapMode(EnumMapUI.Type_Light);
} else if (day_night_mode == 2) {
mView.getUIController().changeMapMode(EnumMapUI.Type_Night);
}
//intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
//intent.putExtra("KEY_TYPE", 10049);
//intent.putExtra("EXTRA_ENDURANCE_DATA", continueNavi);
//继续导航
} else if (key_type == 10049) {
boolean extra_endurance_data =
intent.getBooleanExtra("EXTRA_ENDURANCE_DATA", false);
if (extra_endurance_data) {
mView.getUIController().recoverLockMode();
}
}
}
}
};
IntentFilter inputFilter = new IntentFilter();
inputFilter.addAction(AUTONAVI_STANDARD_BROADCAST_RECV);
getContext().registerReceiver(broadcastReceiver, inputFilter);
}
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
mMogoMapService = ( IMogoMapService ) ARouter.getInstance()
.build( MogoServicePaths.PATH_SERVICES_MAP )
.navigation( getContext() );
mMogoIntentManager = ( IMogoIntentManager ) ARouter.getInstance()
.build( MogoServicePaths.PATH_INTENT_MANAGER )
.navigation( getContext() );
mSearchManager = ( IMogoSearchManager ) ARouter.getInstance()
.build( MogoServicePaths.PATH_SEARCH_MANAGER )
.navigation( getContext() );
public void onCreate(@NonNull LifecycleOwner owner) {
super.onCreate(owner);
mMogoMapService = (IMogoMapService) ARouter.getInstance()
.build(MogoServicePaths.PATH_SERVICES_MAP)
.navigation(getContext());
mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance()
.build(MogoServicePaths.PATH_INTENT_MANAGER)
.navigation(getContext());
mSearchManager = (IMogoSearchManager) ARouter.getInstance()
.build(MogoServicePaths.PATH_SEARCH_MANAGER)
.navigation(getContext());
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
mogoNavi.setCalculatePathDisplayBounds( new Rect(
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.dp_730 )
+ WindowUtils.dip2px( getContext(), 80 ),
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.dp_120 )
+ WindowUtils.dip2px( getContext(), 80 ),
WindowUtils.dip2px( getContext(), 80 ),
WindowUtils.dip2px( getContext(), 80 )
) );
IMogoNavi mogoNavi = mMogoMapService.getNavi(getContext());
mogoNavi.setCalculatePathDisplayBounds(new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(), R.dimen.dp_730)
+ WindowUtils.dip2px(getContext(), 80),
ResourcesHelper.getDimensionPixelSize(getContext(), R.dimen.dp_120)
+ WindowUtils.dip2px(getContext(), 80),
WindowUtils.dip2px(getContext(), 80),
WindowUtils.dip2px(getContext(), 80)
));
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
public void onResume(@NonNull LifecycleOwner owner) {
super.onResume(owner);
registerVoiceCmd();
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
public void onPause(@NonNull LifecycleOwner owner) {
super.onPause(owner);
unregisterVoiceCmd();
}
private void registerVoiceCmd() {
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
for (Map.Entry<String, String[]> entry : VoiceConstants.sVoiceCmds.entrySet()) {
AIAssist.getInstance(getContext())
.registerUnWakeupCommand(entry.getKey(), entry.getValue(), this);
}
for ( String cmd : VoiceConstants.sCmds ) {
mMogoIntentManager.registerIntentListener( cmd, this );
for (String cmd : VoiceConstants.sCmds) {
mMogoIntentManager.registerIntentListener(cmd, this);
}
}
private void unregisterVoiceCmd() {
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( entry.getKey(), this );
for (Map.Entry<String, String[]> entry : VoiceConstants.sVoiceCmds.entrySet()) {
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(entry.getKey(), this);
}
for ( String cmd : VoiceConstants.sCmds ) {
mMogoIntentManager.unregisterIntentListener( cmd );
for (String cmd : VoiceConstants.sCmds) {
mMogoIntentManager.unregisterIntentListener(cmd);
}
}
@Override
public void onIntentReceived( String command, Intent intent ) {
if ( TextUtils.isEmpty( command ) ) {
public void onIntentReceived(String command, Intent intent) {
if (TextUtils.isEmpty(command)) {
return;
}
onCmdSelected( command );
onCmdSelected(command);
}
@Override
public void onCmdSelected( String cmd ) {
Logger.d(TAG,cmd,null);
switch ( cmd ) {
public void onCmdSelected(String cmd) {
Logger.d(TAG, cmd, null);
switch (cmd) {
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开", null );
mView.getUIController().setTrafficEnabled( true );
AIAssist.getInstance(getContext()).speakTTSVoice("已打开", null);
mView.getUIController().setTrafficEnabled(true);
mSearchManager.showSearch();
break;
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已关闭", null );
mView.getUIController().setTrafficEnabled( false );
AIAssist.getInstance(getContext()).speakTTSVoice("已关闭", null);
mView.getUIController().setTrafficEnabled(false);
mSearchManager.showMain();
break;
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已放大", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已放大", null);
case VoiceConstants.CMD_MAP_ZOOM_IN:
mView.getUIController().changeZoom( true );
mView.getUIController().changeZoom(true);
break;
case VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已缩小", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已缩小", null);
case VoiceConstants.CMD_MAP_ZOOM_OUT:
mView.getUIController().changeZoom( false );
mView.getUIController().changeZoom(false);
break;
case VoiceConstants.CMD_MAP_2D_UN_WAKEUP:
case VoiceConstants.CMD_MAP_2D:
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
mView.getUIController().changeMapMode(EnumMapUI.NorthUP_2D);
break;
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_3D:
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
mView.getUIController().changeMapMode(EnumMapUI.CarUp_3D);
break;
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
mView.getUIController().changeMapMode(EnumMapUI.Type_Light);
break;
//case VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP:
@@ -177,29 +243,29 @@ public class MapPresenter extends Presenter< MapView > implements
break;
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_NIGHT_MODE:
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
mView.getUIController().changeMapMode(EnumMapUI.Type_Night);
break;
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
mView.getUIController().changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night);
break;
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
mView.getUIController().displayOverview();
break;
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
mView.getUIController().recoverLockMode();
break;
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
mView.getUIController().changeMapMode(EnumMapUI.CarUp_2D);
break;
//case VoiceConstants.CMD_MAP_GEO_NEARBY:
@@ -229,22 +295,22 @@ public class MapPresenter extends Presenter< MapView > implements
}
@Override
public void onCmdAction( String speakText ) {
public void onCmdAction(String speakText) {
}
@Override
public void onCmdCancel( String speakText ) {
public void onCmdCancel(String speakText) {
}
@Override
public void onSpeakEnd( String speakText ) {
public void onSpeakEnd(String speakText) {
}
@Override
public void onSpeakSelectTimeOut( String speakText ) {
public void onSpeakSelectTimeOut(String speakText) {
}
}

View File

@@ -0,0 +1,312 @@
package com.mogo.module.map;
public class NavConstants {
public interface NativeApi {
/**
* 导航去某地
*/
String NATIVE_API_NAVI = "com.ileja.navi.address.get";
/**
* 继续导航
*/
String NATIVE_API_NAVI_CONTINUE = "com.ileja.navi.continue.get";
/**
* 途径点设置
*/
String NATIVE_API_NAVI_PASSPOI = "com.ileja.navi.passpoi.address.get";
/**
* 沿途搜索
*/
String NATIVE_API_NAVI_WAY_SEARCH = "com.ileja.navi.along.route.poi.query";
/**
*导航路状态
*/
String NATIVE_API_NAVI_STATUS_QUERY = "com.ileja.navi.status.query";
/**
* 下一个服务区查询 service area
*/
String NATIVE_API_NAVI_NEXT_SERVICEAREA = "com.ileja.navi.sapa.query";
/**
* 导航常用地址
*/
String NATIVE_API_NAVI_GET_COMMON_ADDRESS = "com.ileja.navi.address.common.get";
/**
* 提供地址 设置家/公司
*/
String NATIVE_API_NAVI_COMMON_ADDRESS = "com.ileja.navi.common.get";
/**
* 设在当前位置
*/
String NATIVE_API_NAVI_CURRENT_ADDRESS = "com.ileja.navi.common.current.get";
/**
* 导航指令
*/
String NATIVE_API_NAVI_INI_GET = "com.ileja.navi.ini.get";
/**
* 沿途路况
*/
String NATIVE_API_NAVI_WAY_TRAFFIC= "com.ileja.traffic.poi.get";
/**
* 前方路况
*/
String NATIVE_API_NAVI_FRONT_TRAFFIC= "com.ileja.traffic.front.get";
}
interface WakeUpCommandApi {
/**
* 放大地图
*/
String COMMAND_MAP_FLEX_UP = "com.zhidao.map.flex.up";
/**
* 缩小地图
*/
String COMMAND_MAP_FLEX_DOWN= "com.zhidao.map.flex.down";
/**
* 白天模式
*/
String COMMAND_MAP_MODE_DAY= "com.zhidao.map.mode.day";
/**
* 夜晚模式
*/
String COMMAND_MAP_MODE_NIGHT= "com.zhidao.map.mode.night";
/**
* 自动模式
*/
String COMMAND_MAP_MODE_AUTO= "com.zhidao.map.mode.auto";
/**
* * 地图设置为2d 车上模式
*/
String COMMAND_MAP_NAVI_OPEN_2D_CAR = "com.zhidao.map.navi.open.2dcar";
/**
* 地图设置为2d 北上模式
*/
String COMMAND_MAP_NAVI_OPEN_2D_NORTH = "com.zhidao.map.navi.open.2dnorth";
/**
* 地图设置为3d模式
*/
String COMMAND_MAP_NAVI_OPEN_3D = "com.zhidao.map.navi.open.3d";
/**
* 导航偏好设置 推荐路线(导航场景) //推荐路线/躲避拥堵/高速优先/少收费/避免收费/不走高速
*/
String COMMAND_MAP_NAVI_PREFERENCE_RECOMMEND = "com.zhidao.map.preference.recommend";
/**
* 导航偏好设置 躲避拥堵(导航场景)
*/
String COMMAND_MAP_NAVI_PREFERENCE_AVOID_BLOCK = "com.zhidao.map.preference.avoid.block";
/**
* 导航偏好设置 高速优先(导航场景)
*/
String COMMAND_MAP_NAVI_PREFERENCE_HIGHSPEED = "com.zhidao.map.preference.high.speed";
/**
* 导航偏好设置 少收费(导航场景)
*/
String COMMAND_MAP_NAVI_PREFERENCE_LESS_CHARGE = "com.zhidao.map.preference.less.charge";
/**
* 导航偏好设置 避免收费(导航场景)
*/
String COMMAND_MAP_NAVI_PREFERENCE_NO_CHARGE= "com.zhidao.map.preference.no.charge";
/**
* 导航偏好设置 不走高速(导航场景)
*/
String COMMAND_MAP_NAVI_NO_HIGH_SPEED = "com.zhidao.map.preference.avoid.highspeed";
/**
* 打开实况模式
*/
String COMMAND_MAP_NAVI_OPEN_LIVE = "com.zhidao.map.navi.open.live";
/**
* 关闭实况模式
*/
String COMMAND_MAP_NAVI_CLOSE_LIVE = "com.zhidao.map.navi.close.live";
/**
* 进入全览
*/
String COMMAND_MAP_NAVI_ENTER_OVERVIEW = "com.zhidao.map.navi.enter.overview";
/**
* 退出全览
*/
String COMMAND_MAP_NAVI_EXIT_OVERVIEW = "com.zhidao.map.navi.exit.overview";
/**
* 继续导航 返回导航
*/
String COMMAND_MAP_NAVI_OVERVIEW_BACK_NAVI = "com.zhidao.map.navi.backnavi";
/**
* 刷新路线
*/
String COMMAND_MAP_NAVI_REFRESH_PATH= "com.zhidao.map.navi.refresh.path";
/**
* 选择线路
*/
String COMMAND_MAP_SELECT_PATH1 = "com.zhidao.map.select.path1";
String COMMAND_MAP_SELECT_PATH2 = "com.zhidao.map.select.path2";
String COMMAND_MAP_SELECT_PATH3 = "com.zhidao.map.select.path3";
/**
* 继续导航 确定
*/
String COMMAND_ZHIDAO_CONTINUE_SURE = "com.zhidao.contine.sure";
/**
* 继续导航 取消
*/
String COMMAND_ZHIDAO_CONTINUE_CANCLE = "com.zhidao.contine.cancle";
/**
* 规划界面 确定
*/
String COMMAND_ZHIDAO_PLAN_SURE = "com.zhidao.plan.sure";
/**
* 规划界面 取消
*/
String COMMAND_ZHIDAO_PLAN_CANCLE = "com.zhidao.v.cancle";
/**
* 关闭地图
*/
String COMMAND_MAP_CLOSEMAP = "com.zhidao.map.close";
}
interface CommmandApi {
/**
* 选择导航
*/
String COMMAND_NAVI_RESULT_SELECT = "com.ileja.navi.jump.route";
/**
* 继续导航
*/
String COMMAND_NAVI_CONTINUE = "com.ileja.navi.route.continue";
/**
* 导航过程中增加途径点
*/
String COMMAND_NAVI_ADD_PASSPOINT = "com.ileja.navi.passpoi.address.result";
/**
* 目的地纠错
*/
String COMMAND_NAVI_CHANGE_DES = "com.ileja.navi.address.change";
/**
* 酒店查询
*/
String COMMAND_HOTEL_SELECT = "com.aispeech.hotel.select";
/**
* 美食查询
*/
String COMMAND_FOOD_SELECT = "com.aispeech.food.select";
/**
* 查询我的位置
*/
String COMMAND_NAVI_MYLOCATION = "com.ileja.navi.mylocation.query";
/**
* 白天模式
*/
String COMMAND_NAVI_DAY_MODE = "com.ileja.navi.mode.daytime";
/**
* 夜晚模式
*/
String COMMAND_NAVI_NIGHT_MODE = "com.ileja.navi.mode.night";
/**
* 夜晚模式
*/
String COMMAND_NAVI_AUTODAY_MODE = "com.ileja.navi.mode.autodaynight";
/**
* 打开实况
*/
String COMMAND_NAVI_TRAFFIC_OPEN = "com.ileja.navi.traffic.open";
/**
* 关闭实况
*/
String COMMAND_NAVI_TRAFFIC_CLOSE = "com.ileja.navi.traffic.close";
/**
* 车头朝上
*/
String COMMAND_NAVI_TRAFFIC_HEAD_UP = "com.ileja.traffic.head.up";
/**
* 北朝上
*/
String COMMAND_NAVI_TRAFFIC_NORTH_UP = "com.ileja.traffic.north.up";
/**
* 选择沿途搜索
*/
String COMMAND_NAVI_AWAY_SEARCH = "com.ileja.navi.along.route.poi.select";
/**
* 打开地图相关操作
*/
String COMMAND_NAVI_OPEN_MAP = "com.ileja.navi.map.open";
/**
* 退出地图相关操作
*/
String COMMAND_NAVI_CLOSE_MAP = "com.ileja.navi.map.close";
/**
* 退出导航
*/
String COMMAND_NAVI_EXIT_NAVI = "com.ileja.navi.exit";
/**
* 放大地图
*/
String COMMAND_NAVI_MAP_ENLARGE = "com.ileja.navi.map.enlarge";
/**
* 缩小地图
*/
String COMMAND_NAVI_MAP_REDUCE = "com.ileja.navi.map.reduce";
/**
* 全览图
*/
String COMMAND_NAVI_FULL_MAP = "com.ileja.navi.map.full";
/**
* 3D模式
*/
String COMMAND_NAVI_MODE_3D = "com.ileja.navi.mode.3d";
/**
* 2D模式
*/
String COMMAND_NAVI_MODE_2D = "com.ileja.navi.mode.2d";
/**
* 收藏当前位置
*/
String COMMAND_NAVI_COLLECTION_CURRENT= "com.ileja.navi.collection.location";
/**
* 设在当前位置
*/
String COMMAND_NAVI_COMMON_CURRENT= "com.ileja.navi.common.current";
/**
* 导航剩余距离
*/
String COMMAND_NAVI_QUERY_DISTANCE= "com.ileja.navi.remaining.distance";
/**
* 导航剩時間
*/
String COMMAND_NAVI_QUERY_TIME= "com.ileja.navi.remaining.time";
/**
* 查询路况
*/
String COMMAND_NAVI_QUERY_TRAFFIC= "com.ileja.traffic.show";
/**
* 去常用地址的沿途路况
*/
String COMMAND_NAVI_COMMON_SIT= "com.ileja.traffic.turn.common.site";
/**
* 拥堵情况
*/
String COMMAND_NAVI_WAY_TRAFFIC= "com.ileja.traffic.route";
/**
* 航班查询
*/
String COMMAND_FLIGHT_RESULT= "native.flight.result";
}
}

View File

@@ -163,6 +163,25 @@ public class VoiceConstants {
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久","多久到","还有多远"};
//mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OVERVIEW_BACK_NAVI).setWord("继续导航").setPinyin("ji xu dao hang").setThreshold("0.21").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭导航").setPinyin("guan bi dao hang").setThreshold("0.19").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭地图").setPinyin("guan bi di tu").setThreshold("0.215").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出导航").setPinyin("tui chu dao hang").setThreshold("0.2").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出地图").setPinyin("tui chu di tu").setThreshold("0.16").addGreeting(""));
//
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_CAR).setWord("车头朝上").setPinyin("che tou chao shang").setThreshold("0.1").addGreeting("车头朝上"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("北朝上").setPinyin("bei chao shang").setThreshold("0.14").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_3D).setWord("三地模式").setPinyin("san di mo shi").setThreshold("0.13").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("二地模式").setPinyin("er di mo shi").setThreshold("0.185").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_UP).setWord("放大地图").setPinyin("fang da di tu").setThreshold("0.17").addGreeting("已放大"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_DOWN).setWord("缩小地图").setPinyin("suo xiao di tu").setThreshold("0.125").addGreeting("已缩小"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_DAY).setWord("白天模式").setPinyin("bai tian mo shi").setThreshold("0.105").addGreeting("切换到白天模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_NIGHT).setWord("夜间模式").setPinyin("ye jian mo shi").setThreshold("0.11").addGreeting("切换到夜间模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_AUTO).setWord("自动模式").setPinyin("zi dong mo shi").setThreshold("0.11").addGreeting("切换到自动模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_LIVE).setWord("打开路况").setPinyin("da kai lu kuang").setThreshold("0.125").addGreeting("路况已打开"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_CLOSE_LIVE).setWord("关闭路况").setPinyin("guan bi lu kuang").setThreshold("0.1").addGreeting("路况已关闭"));
@@ -171,27 +190,27 @@ public class VoiceConstants {
static {
// 免唤醒
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_2D_UN_WAKEUP, VoiceConstants.CMD_MAP_2D_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_3D_UN_WAKEUP, VoiceConstants.CMD_MAP_3D_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_2D_UN_WAKEUP, VoiceConstants.CMD_MAP_2D_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_3D_UN_WAKEUP, VoiceConstants.CMD_MAP_3D_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_GO_HOME_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_GO_HOME );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_GO_COMPANY );
sVoiceCmds.put( VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP, VoiceConstants.CMD_MAP_HISTORY_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_GEO_NEARBY_WAKEUP, VoiceConstants.CMD_MAP_GEO_NEARBY_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_GEO_NEARBY_WAKEUP, VoiceConstants.CMD_MAP_GEO_NEARBY_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_REMAIN_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_REMAIN_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS );
// 唤醒
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_IN );
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_OUT );

View File

@@ -165,4 +165,5 @@ public class AddressContentProvider extends ContentProvider {
public int update( @NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs ) {
return 0;
}
}

View File

@@ -29,7 +29,7 @@ object NaviManager {
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
val key_type = intent.getIntExtra("KEY_TYPE", 0)
Logger.d("NaviManager","key_type"+key_type,null)
if (key_type == 10038) {
if (key_type == 10038||key_type == 10007) {
val lat = intent.getDoubleExtra("LAT", 0.0)
val lon = intent.getDoubleExtra("LON", 0.0)