增加语音指令

This commit is contained in:
zhangyuanzhen
2020-01-18 11:01:15 +08:00
parent f0b26105ef
commit ed182ed7e7
2 changed files with 53 additions and 0 deletions

View File

@@ -200,6 +200,28 @@ public class MapPresenter extends Presenter< MapView > implements
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
break;
//case VoiceConstants.CMD_MAP_GEO_NEARBY:
// if (intent != null) {
// String keywords = intent.getStringExtra("keyword");
// mSearchManager.showCategory(keywords);
// }
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
//mSearchManager.speakDraft();
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
break;
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
//mSearchManager.speakDetail();
AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
break;
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
break;
default:
break;
}
}

View File

@@ -140,6 +140,31 @@ public class VoiceConstants {
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.traffic.north.up";
public static final String CMD_MAP_NORTH_UP_MODE_UN_WAKEUP = "CMD_MAP_NORTH_UP_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"北朝上"};
/**
* 简洁模式
*/
public static final String CMD_MAP_SPEAK_DRAFT_MODE = "com.ileja.traffic.speak.draft";
public static final String CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS = {"简洁模式"};
/**
* 详细模式
*/
public static final String CMD_MAP_SPEAK_DETAIL_MODE = "com.ileja.traffic.speak.detail";
public static final String CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS = {"详细模式"};
/**
* 播报当前导航剩余里程和时间
*/
public static final String CMD_MAP_SPEAK_REMAIN = "com.ileja.traffic.speak.remain";
public static final String CMD_MAP_SPEAK_REMAIN_UN_WAKEUP = "CMD_MAP_SPEAK_REMAIN_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久","多久到","还有多远"};
public static final Map< String, String[] > sVoiceCmds = new HashMap<>();
public static final List< String > sCmds = new ArrayList<>();
@@ -164,6 +189,9 @@ public class VoiceConstants {
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_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 );
// 唤醒
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_IN );
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_OUT );
@@ -182,5 +210,8 @@ public class VoiceConstants {
sCmds.add( VoiceConstants.CMD_MAP_GO_COMPANY );
sCmds.add( VoiceConstants.CMD_MAP_HISTORY );
sCmds.add( VoiceConstants.CMD_MAP_STOP_NAVI_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_REMAIN );
}
}