opt
This commit is contained in:
@@ -4,6 +4,8 @@ import android.app.Application;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
@@ -17,6 +19,7 @@ import com.mogo.commons.network.ParamsUtil;
|
||||
import com.mogo.commons.network.X509TrustManagerImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipDrawable;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
@@ -54,7 +57,13 @@ public class AbsMogoApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sApp = this;
|
||||
init();
|
||||
if ( shouldInit() ) {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldInit(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
@@ -69,13 +78,26 @@ public class AbsMogoApplication extends Application {
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
TipToast.init( this, ( ( context, message ) -> {
|
||||
TipToast.init( this, ( ( context, message, tipDrawable ) -> {
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return null;
|
||||
}
|
||||
View contentView = LayoutInflater.from( context ).inflate( R.layout.module_commons_layout_toast, null );
|
||||
TextView txt = contentView.findViewById( R.id.module_commons_toast_msg );
|
||||
txt.setText( message );
|
||||
View contentView;
|
||||
if(tipDrawable==null) {
|
||||
contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast, null);
|
||||
TextView txt = contentView.findViewById(R.id.module_commons_toast_msg);
|
||||
txt.setText(message);
|
||||
}else{
|
||||
// 有图片,使用带图片的布局,当前只实现了左侧图片
|
||||
contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast_with_left_drawable, null);
|
||||
TextView txt = contentView.findViewById(R.id.module_commons_toast_msg);
|
||||
ImageView img = contentView.findViewById(R.id.module_commons_toast_left_drawable);
|
||||
img.setImageDrawable(tipDrawable.getDrawable());
|
||||
ViewGroup.LayoutParams params = img.getLayoutParams();
|
||||
params.width = tipDrawable.getWidth();
|
||||
params.height = tipDrawable.getHeight();
|
||||
txt.setText(message);
|
||||
}
|
||||
return contentView;
|
||||
} ) );
|
||||
DebugConfig.setUseCustomMap( SharedPrefsMgr.getInstance( this ).getBoolean( "useCustomMap", false ) );
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.commons.context;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class ContextHolderUtil {
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
public static void holdContext(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static void releaseContext() {
|
||||
mContext = null;
|
||||
}
|
||||
|
||||
public static Context getContext(){
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sDebug true - 调试模式 false - 非调试模式
|
||||
*/
|
||||
public static void setDebug( boolean sDebug ) {
|
||||
public static void setDebug(boolean sDebug) {
|
||||
DebugConfig.sDebug = sDebug;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,15 @@ public class DebugConfig {
|
||||
|
||||
private static int sCarMachineType = CAR_MACHINE_TYPE_SELF_INNOVATE;
|
||||
|
||||
/**
|
||||
* 西迪obu
|
||||
*/
|
||||
public static final int OBU_TYPE_CIDI = 1;
|
||||
/**
|
||||
* 华砺智行obu
|
||||
*/
|
||||
public static final int OBU_TYPE_HUALI = 2;
|
||||
|
||||
/**
|
||||
* 获取网络环境类型
|
||||
*
|
||||
@@ -102,7 +111,7 @@ public class DebugConfig {
|
||||
* {@link #NET_MODE_DEMO}
|
||||
* {@link #NET_MODE_RELEASE}
|
||||
*/
|
||||
public static void setNetMode( int netMode ) {
|
||||
public static void setNetMode(int netMode) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
@@ -115,7 +124,7 @@ public class DebugConfig {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
@@ -128,33 +137,16 @@ public class DebugConfig {
|
||||
return sUseCustomNavi;
|
||||
}
|
||||
|
||||
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
|
||||
public static void setUseCustomNavi(boolean sUseCustomNavi) {
|
||||
DebugConfig.sUseCustomNavi = sUseCustomNavi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置使用哪个语音助手
|
||||
*
|
||||
* @param aiType {@link #AI_TYPE_NOOP} {@link #AI_TYPE_TXZ} {@link #AI_TYPE_SPEECH}
|
||||
*/
|
||||
public static void setAIType( int aiType ) {
|
||||
Logger.d( "DebugConfig", "setAiType: " + aiType );
|
||||
sAIType = aiType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用哪个语音助手 {@link #AI_TYPE_NOOP} {@link #AI_TYPE_TXZ} {@link #AI_TYPE_SPEECH}
|
||||
*/
|
||||
public static int getAIType() {
|
||||
return sAIType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前车机类型
|
||||
*
|
||||
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
|
||||
*/
|
||||
public static void setCarMachineType( int type ) {
|
||||
public static void setCarMachineType(int type) {
|
||||
sCarMachineType = type;
|
||||
}
|
||||
|
||||
@@ -176,7 +168,7 @@ public class DebugConfig {
|
||||
return sIsLauncher;
|
||||
}
|
||||
|
||||
public static void setLauncher( boolean isLauncher ) {
|
||||
public static void setLauncher(boolean isLauncher) {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
@@ -186,7 +178,7 @@ public class DebugConfig {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
@@ -208,13 +200,13 @@ public class DebugConfig {
|
||||
return sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) {
|
||||
public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) {
|
||||
DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData( boolean use ) {
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
@@ -233,13 +225,13 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sProductFlavor
|
||||
*/
|
||||
public static void setProductFlavor( String sProductFlavor ) {
|
||||
public static void setProductFlavor(String sProductFlavor) {
|
||||
DebugConfig.sProductFlavor = sProductFlavor;
|
||||
}
|
||||
|
||||
private static String sSocketAppId;
|
||||
|
||||
public static void setSocketAppId( String sSocketAppId ) {
|
||||
public static void setSocketAppId(String sSocketAppId) {
|
||||
DebugConfig.sSocketAppId = sSocketAppId;
|
||||
}
|
||||
|
||||
@@ -256,7 +248,83 @@ public class DebugConfig {
|
||||
return sRoadEventAnimated;
|
||||
}
|
||||
|
||||
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
|
||||
public static void setRoadEventAnimated(boolean sRoadEventAnimated) {
|
||||
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
|
||||
}
|
||||
|
||||
|
||||
private static boolean sLoadGuideModule = false;
|
||||
|
||||
public static void setLoadGuideModule(boolean sLoadGuideModule) {
|
||||
DebugConfig.sLoadGuideModule = sLoadGuideModule;
|
||||
}
|
||||
|
||||
public static boolean isLoadGuideModule() {
|
||||
return sLoadGuideModule;
|
||||
}
|
||||
|
||||
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
|
||||
|
||||
public static String getSpGuide() {
|
||||
return SP_GUIDE;
|
||||
}
|
||||
|
||||
private static boolean isSkinSupported = false;
|
||||
|
||||
public static void setSkinSupported(boolean isSkinSupported) {
|
||||
DebugConfig.isSkinSupported = isSkinSupported;
|
||||
}
|
||||
|
||||
public static boolean isSkinSupported() {
|
||||
return isSkinSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持支持查询导航目的地车友信息
|
||||
*/
|
||||
private static boolean isSupportedSearchDestinationOnlineCarList = false;
|
||||
|
||||
public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) {
|
||||
DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList;
|
||||
}
|
||||
|
||||
public static boolean isSupportedSearchDestinationOnlineCarList() {
|
||||
return isSupportedSearchDestinationOnlineCarList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持目的地导航推送策略
|
||||
*/
|
||||
private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false;
|
||||
|
||||
public static void setScheduleCalculateNotHomeCompanyDistanceForPush( boolean isScheduleCalculateNotHomeCompanyDistanceForPush ) {
|
||||
DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
public static boolean isIsScheduleCalculateNotHomeCompanyDistanceForPush() {
|
||||
return isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持刷新桌面卡片
|
||||
*/
|
||||
private static boolean isSupportLauncherCardRefreshStrategy = false;
|
||||
|
||||
public static void setSupportLauncherCardRefreshStrategy( boolean isSupportLauncherCardRefreshStrategy ) {
|
||||
DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
public static boolean isIsSupportLauncherCardRefreshStrategy() {
|
||||
return isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
private static int obuType = OBU_TYPE_HUALI;
|
||||
|
||||
public static int getObuType() {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType(int type) {
|
||||
obuType = type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.commons.mvp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@@ -10,8 +9,10 @@ import android.view.WindowManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.skin.support.MogoSkinManager;
|
||||
import com.mogo.utils.SoftKeyBoardJobber;
|
||||
|
||||
/**
|
||||
@@ -28,9 +29,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
beforeSetContentView(savedInstanceState);
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
||||
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
|
||||
}
|
||||
setContentView( getLayoutId() );
|
||||
initViews();
|
||||
@@ -38,6 +40,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
getLifecycle().addObserver( mPresenter );
|
||||
}
|
||||
|
||||
protected void beforeSetContentView(Bundle savedInstanceState){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
@@ -76,6 +82,7 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
}
|
||||
return onTouchEvent( ev );
|
||||
}
|
||||
|
||||
protected boolean enableDispatchTouchEventToDismissSoftKeyBoard() {
|
||||
return true;
|
||||
}
|
||||
@@ -89,4 +96,11 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
}
|
||||
mPresenter = null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppCompatDelegate getDelegate() {
|
||||
return MogoSkinManager.getInstance().getInstaller().getSkinAppCompatDelegate(this,
|
||||
super.getDelegate(), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
initViews(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +60,7 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initViews();
|
||||
initViews(savedInstanceState);
|
||||
mPresenter = createPresenter();
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
@Nullable
|
||||
protected <T extends View> T findViewById(int id) {
|
||||
if (mRootView == null) {
|
||||
mRootView = getView().findViewById(id);
|
||||
mRootView = getView();
|
||||
}
|
||||
if (mRootView != null) {
|
||||
return (T) mRootView.findViewById(id);
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.utils.DeviceIdUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.auto.platform.util.DeviceUtil;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
@@ -37,7 +36,7 @@ public class ParamsUtil {
|
||||
params.put( ServerParam.NET_TYPE, CommonUtils.getNetworkType( AbsMogoApplication.getApp() ) );
|
||||
params.put( ServerParam.CELL_ID, Utils.getCellId( AbsMogoApplication.getApp() ) );
|
||||
|
||||
params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() );
|
||||
// params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() );
|
||||
params.put( ServerParam.SN, Utils.getSn() );
|
||||
params.put( ServerParam.TICKET, SpStorage.getTicket() );
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.commons.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
|
||||
@@ -18,4 +18,12 @@ public class SpStorage {
|
||||
public static void setTicket( String ticket ) {
|
||||
SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "ticket", ticket );
|
||||
}
|
||||
|
||||
public static String getNavigationTarget(){
|
||||
return SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getString( "naviTarget" );
|
||||
}
|
||||
|
||||
public static void setNavigationTarget( String naviTarget ) {
|
||||
SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "naviTarget", naviTarget );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
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;
|
||||
import com.zhidao.voicesdk.MogoVoiceManagerImpl;
|
||||
import com.zhidao.voicesdk.callback.OnConnStatusListener;
|
||||
import com.zhidao.voicesdk.callback.OnTtsListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.tts.base.IMogoTTS;
|
||||
import com.mogo.tts.base.MogoTTSConstants;
|
||||
import com.mogo.tts.base.PreemptType;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -27,14 +13,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 语音助手通信助手
|
||||
*/
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
public class AIAssist {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
private static volatile AIAssist sInstance;
|
||||
private String mLastQAndASpeakText;
|
||||
|
||||
private boolean mHasFlush = false;
|
||||
private boolean mInitReady = false;
|
||||
private IMogoTTS mTTS;
|
||||
|
||||
public static AIAssist getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
@@ -48,61 +31,15 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
Logger.d( TAG, "release" );
|
||||
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
|
||||
for ( String cmd : mCmdMap.keySet() ) {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
}
|
||||
if ( mTTS != null ) {
|
||||
mTTS.release();
|
||||
}
|
||||
mQAndAMap.clear();
|
||||
mVoiceClient.release();
|
||||
mSpeakVoiceMap.clear();
|
||||
mCacheUnWakeupCommands.clear();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private final VoiceClient mVoiceClient;
|
||||
private MogoVoiceManager mogoVoiceManager;
|
||||
// 免唤醒指令
|
||||
private Map< String, List< IMogoVoiceCmdCallBack > > mCmdMap = new HashMap<>();
|
||||
// 问答指令
|
||||
private Map< String, IMogoVoiceCmdCallBack > mQAndAMap = new HashMap<>();
|
||||
// 单独的语音播放
|
||||
private Map< String, IMogoVoiceCmdCallBack > mSpeakVoiceMap = new HashMap<>();
|
||||
|
||||
private Map< String, String[] > mCacheUnWakeupCommands = new ConcurrentHashMap<>();
|
||||
|
||||
private AIAssist( Context context ) {
|
||||
// private constructor
|
||||
mVoiceClient = new VoiceClient( context.getApplicationContext() );
|
||||
mVoiceClient.setCallBack( this );
|
||||
initFlushStatus( context );
|
||||
initSpeech( context );
|
||||
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||
}
|
||||
|
||||
private void initFlushStatus( Context context ) {
|
||||
if ( !mHasFlush ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private void initSpeech( Context context ) {
|
||||
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||
mogoVoiceManager.init( context, new OnConnStatusListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
mInitReady = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
|
||||
}
|
||||
} );
|
||||
mTTS = ( IMogoTTS ) ARouter.getInstance().build( MogoTTSConstants.API_PATH ).navigation( context.getApplicationContext() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,83 +48,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasFlush() {
|
||||
return mHasFlush;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "received command: %s", cmd );
|
||||
|
||||
Iterator< IMogoVoiceCmdCallBack > iterator = null;
|
||||
try {
|
||||
List< IMogoVoiceCmdCallBack > cmdCallBacks = mCmdMap.get( cmd );
|
||||
iterator = new ArrayList<>( cmdCallBacks ).iterator();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
while ( iterator != null && iterator.hasNext() ) {
|
||||
IMogoVoiceCmdCallBack callBack = iterator.next();
|
||||
if ( callBack != null ) {
|
||||
callBack.onCmdSelected( cmd );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdAction( speakText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdCancel( speakText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
mLastQAndASpeakText = speakText;
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.get( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onSpeakEnd( speakText );
|
||||
return;
|
||||
}
|
||||
}
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakEnd( speakText );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
if ( TextUtils.equals( speakText, mLastQAndASpeakText ) ) {
|
||||
mLastQAndASpeakText = null;
|
||||
}
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onSpeakSelectTimeOut( speakText );
|
||||
return;
|
||||
}
|
||||
}
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakSelectTimeOut( speakText );
|
||||
if ( mTTS != null ) {
|
||||
return mTTS.hasFlush();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,13 +60,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param text
|
||||
*/
|
||||
public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSVoice( text, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,12 +71,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param text
|
||||
*/
|
||||
public void speakTTSVoice( String text ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSVoice( text );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +83,25 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param type 播报策略
|
||||
*/
|
||||
public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
if ( mTTS != null ) {
|
||||
PreemptType preemptType = PreemptType.PREEMPT_TYPE_NONE;
|
||||
if ( type != null ) {
|
||||
switch ( type ) {
|
||||
case PREEMPT_TYPE_FLUSH:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_FLUSH;
|
||||
break;
|
||||
case PREEMPT_TYPE_NEXT:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_NEXT;
|
||||
break;
|
||||
case PREEMPT_TYPE_IMMEADIATELY:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_IMMEDIATELY;
|
||||
break;
|
||||
case PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_IMMEDIATELY_WITHOUT_CANCEL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
mTTS.speakTTSVoice( text, preemptType, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,10 +111,8 @@ 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 );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakQAndACmd( tts, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,10 +124,8 @@ 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 );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakQAndACmd( tts, okCmds, cancelCmds, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,47 +137,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param callBack
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.registerUnWakeupCommand( cmd, cmdWords, callBack );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令
|
||||
*
|
||||
* @param cmd
|
||||
* @param cmdWords
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
Logger.i( TAG, "cache un wakeup command. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令回调
|
||||
*
|
||||
* @param cmd
|
||||
* @param callBack
|
||||
*/
|
||||
public synchronized void registerUnWakeupCommandCallback( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,9 +148,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmd
|
||||
*/
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd ) {
|
||||
mCmdMap.remove( cmd );
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.unregisterUnWakeupCommand( cmd );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,20 +159,12 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmd
|
||||
*/
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( mCmdMap.containsKey( cmd ) ) {
|
||||
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
|
||||
if ( callBacks != null ) {
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
if ( callBacks.isEmpty() ) {
|
||||
mCmdMap.remove( cmd );
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
if ( mTTS != null ) {
|
||||
mTTS.unregisterUnWakeupCommand( cmd, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
public static void startAssistant( Context context ) {
|
||||
public void startAssistant( Context context ) {
|
||||
startAssistant( context, 1 );
|
||||
}
|
||||
|
||||
@@ -355,160 +172,49 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param context
|
||||
* @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入
|
||||
*/
|
||||
public static void startAssistant( Context context, int status ) {
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
intent.putExtra( "window_start_cancel", status );
|
||||
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||
Logger.d( TAG, "status = %d", status );
|
||||
context.sendBroadcast( intent );
|
||||
public void startAssistant( Context context, int status ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.startAIAssist( context, status );
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void flush() {
|
||||
if ( mCacheUnWakeupCommands.isEmpty() ) {
|
||||
return;
|
||||
if ( mTTS != null ) {
|
||||
mTTS.flush();
|
||||
}
|
||||
mHasFlush = true;
|
||||
Logger.d( TAG, "flush cache voice command when voice service ready." );
|
||||
final Map< String, String[] > tmp = new HashMap<>( mCacheUnWakeupCommands );
|
||||
for ( String cmd : tmp.keySet() ) {
|
||||
registerUnWakeupCommand( cmd, tmp.get( cmd ) );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVoiceServiceReady( Context context ) {
|
||||
if ( isProcessRunning( context, getPackageUid( context, "com.zhidao.speech" ) )
|
||||
&& isProcessRunning( context, getPackageUid( context, "com.zhidao.speech.adapter" ) ) ) {
|
||||
return true;
|
||||
} else if (isProcessRunning(context, getPackageUid(context, "com.txznet.txz")) && isProcessRunning(context, getPackageUid(context, "com.txznet.adapter"))) {
|
||||
Logger.d(TAG, "txz is voiceServiceReady");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// private boolean isRunningTaskExist( Context context, String processName ) {
|
||||
//// ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
//// List< ActivityManager.RunningAppProcessInfo > processList = am.getRunningAppProcesses();
|
||||
//// for ( ActivityManager.RunningAppProcessInfo info : processList ) {
|
||||
//// if ( info.processName.equals( processName ) ) {
|
||||
//// return true;
|
||||
//// }
|
||||
//// }
|
||||
//// return false;
|
||||
//// }
|
||||
|
||||
/**
|
||||
* 方法描述:判断某一应用是否正在运行
|
||||
* Created by cafeting on 2017/2/4.
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param packageName 应用的包名
|
||||
* @return true 表示正在运行,false 表示没有运行
|
||||
*/
|
||||
public static boolean isAppRunning( Context context, String packageName ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 100 );
|
||||
if ( list.size() <= 0 ) {
|
||||
return false;
|
||||
}
|
||||
for ( ActivityManager.RunningTaskInfo info : list ) {
|
||||
if ( info.baseActivity.getPackageName().equals( packageName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//获取已安装应用的 uid,-1 表示未安装此应用或程序异常
|
||||
public static int getPackageUid( Context context, String packageName ) {
|
||||
try {
|
||||
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo( packageName, 0 );
|
||||
if ( applicationInfo != null ) {
|
||||
return applicationInfo.uid;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某一 uid 的程序是否有正在运行的进程,即是否存活
|
||||
* Created by cafeting on 2017/2/4.
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param uid 已安装应用的 uid
|
||||
* @return true 表示正在运行,false 表示没有运行
|
||||
*/
|
||||
public static boolean isProcessRunning( Context context, int uid ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningServiceInfo > runningServiceInfos = am.getRunningServices( 200 );
|
||||
if ( runningServiceInfos.size() > 0 ) {
|
||||
for ( ActivityManager.RunningServiceInfo appProcess : runningServiceInfos ) {
|
||||
if ( uid == appProcess.uid ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text ) {
|
||||
speakTTSAndDuck( text, null );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSAndDuck( text );
|
||||
}
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
if ( mInitReady ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mogoVoiceManager.toSpeak( text, -3, this );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSAndDuck( text, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
public void shutUp( String ttsId, String text ) {
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
mogoVoiceManager.shutUp( ttsId );
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.shutUp( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打断上一条正在播报的语音内容,仅在Speech上生效,TXZ为空实现
|
||||
* 语音SDK生效版本从1.0.8.4版本起
|
||||
*/
|
||||
public void breakOffSpeak() {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.breakOffSpeak();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearTTSCallback( String text ) {
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
if ( mTTS != null ) {
|
||||
mTTS.clearTTSCallback( text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsStart( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.get( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSStart( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsFinish( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSEnd( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsError( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSError( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,66 +1,7 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
public interface IMogoVoiceCmdCallBack {
|
||||
import com.mogo.tts.base.IMogoTTSCallback;
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSStart( String ttsId, String tts ) {
|
||||
}
|
||||
public interface IMogoVoiceCmdCallBack extends IMogoTTSCallback {
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSEnd( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSError( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 免唤醒命令响应回调
|
||||
*
|
||||
* @param cmd
|
||||
*/
|
||||
default void onCmdSelected( String cmd ){}
|
||||
|
||||
/**
|
||||
* 语音播报临时免唤醒“确定”命令
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onCmdAction( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报临时免唤醒“取消”命令
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onCmdCancel( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报完毕
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onSpeakEnd( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报完临时命令选择超时
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onSpeakSelectTimeOut( String speakText ){}
|
||||
}
|
||||
@@ -1,23 +1,9 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
|
||||
public enum VoicePreemptType {
|
||||
|
||||
|
||||
PREEMPT_TYPE_NONE( VoiceClient.PreemptType.PREEMPT_TYPE_NONE ), //不打断
|
||||
PREEMPT_TYPE_IMMEADIATELY( VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY ), //立即打断,取消当前的tts插队播放
|
||||
PREEMPT_TYPE_NEXT( VoiceClient.PreemptType.PREEMPT_TYPE_NEXT ), //下一个插入,不取消当前的tts,插队下一个播放
|
||||
PREEMPT_TYPE_FLUSH( VoiceClient.PreemptType.PREEMPT_TYPE_FLUSH ), //清空队列
|
||||
PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE( VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE ); //立即打断,不取消当前tts
|
||||
|
||||
public VoiceClient.PreemptType preemptType;
|
||||
|
||||
VoicePreemptType( VoiceClient.PreemptType preemptType ) {
|
||||
this.preemptType = preemptType;
|
||||
}
|
||||
|
||||
public VoiceClient.PreemptType getPreemptType() {
|
||||
return preemptType;
|
||||
}
|
||||
PREEMPT_TYPE_NONE, //不打断
|
||||
PREEMPT_TYPE_IMMEADIATELY, //立即打断,取消当前的tts插队播放
|
||||
PREEMPT_TYPE_NEXT, //下一个插入,不取消当前的tts,插队下一个播放
|
||||
PREEMPT_TYPE_FLUSH, //清空队列
|
||||
PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE; //立即打断,不取消当前tts
|
||||
}
|
||||
Reference in New Issue
Block a user