opt
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||
@@ -81,7 +82,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
|
||||
private void initFlushStatus( Context context ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
if ( !mHasFlush ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +197,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
@@ -209,6 +213,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
@@ -224,6 +229,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
@@ -238,6 +244,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param tts 播报内容
|
||||
*/
|
||||
public void speakQAndACmd( String tts, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||
@@ -252,6 +259,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cancelCmds 取消命令唤醒词
|
||||
*/
|
||||
public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||
@@ -271,6 +279,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
@@ -286,6 +295,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmdWords
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
|
||||
Reference in New Issue
Block a user