merge
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.voice
|
||||
package com.mogo.eagle.core.function.v2x.events.voice
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -8,12 +8,9 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME
|
||||
import com.mogo.service.intent.IMogoIntentListener
|
||||
import com.mogo.service.module.IMogoActionListener
|
||||
import com.mogo.service.module.MogoAction
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.*
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -28,13 +25,10 @@ import com.mogo.eagle.core.function.v2x.events.voice.*
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoActionListener, IMogoIntentListener {
|
||||
object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoIntentListener {
|
||||
private val TAG = V2XVoiceManager.javaClass.simpleName
|
||||
private lateinit var mContext: WeakReference<Context>
|
||||
|
||||
// 翻页回调
|
||||
private var voicePagingListener: V2XVoicePagingListener? = null
|
||||
|
||||
// 记录,免唤醒和唤醒词及对应的回调
|
||||
private val voiceCallbackMap = ConcurrentHashMap<String, V2XVoiceCallbackListener>()
|
||||
|
||||
@@ -123,34 +117,6 @@ object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoActionListener, IMogoIntent
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册翻页回调监听
|
||||
*/
|
||||
@Synchronized
|
||||
fun registerPagingCallback(voicePagingListener: V2XVoicePagingListener): V2XVoiceManager {
|
||||
try {
|
||||
this.voicePagingListener = voicePagingListener
|
||||
BridgeApi.actionManager()?.registerActionListener(MODULE_NAME, this)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 反注册翻页回调监听
|
||||
*/
|
||||
@Synchronized
|
||||
fun unRegisterPagingCallback(): V2XVoiceManager {
|
||||
try {
|
||||
this.voicePagingListener = null
|
||||
BridgeApi.actionManager()?.unregisterActionListener(MODULE_NAME, this)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun onIntentReceived(command: String?, intent: Intent?) {
|
||||
Logger.d(MODULE_NAME, "v2x voice command= $command")
|
||||
voiceCallbackMap[command]?.onCallback(command, intent)
|
||||
@@ -161,22 +127,6 @@ object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoActionListener, IMogoIntent
|
||||
voiceCallbackMap[cmd]?.onCallback(cmd, null)
|
||||
}
|
||||
|
||||
override fun onActionDone(action: MogoAction?) {
|
||||
try {
|
||||
Logger.d(MODULE_NAME, "v2x voice command== onActionDone $action")
|
||||
when (action) {
|
||||
MogoAction.Next -> {
|
||||
voicePagingListener?.onNextCallback()
|
||||
}
|
||||
MogoAction.Prev -> {
|
||||
voicePagingListener?.onPrevCallback()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.voice;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/21 4:47 PM
|
||||
* desc : 语音翻页回调
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface V2XVoicePagingListener {
|
||||
void onNextCallback();
|
||||
|
||||
void onPrevCallback();
|
||||
}
|
||||
Reference in New Issue
Block a user