|
@@ -8,7 +8,6 @@ import android.view.View
|
|
|
import com.alibaba.android.vlayout.DelegateAdapter
|
|
|
import com.alibaba.android.vlayout.VirtualLayoutManager
|
|
|
import com.enation.javashop.android.jrouter.external.annotation.Autowired
|
|
|
-import com.enation.javashop.android.jrouter.external.annotation.Router
|
|
|
import com.enation.javashop.net.engine.model.NetState
|
|
|
import com.google.common.base.Strings
|
|
|
import com.google.gson.Gson
|
|
@@ -20,8 +19,8 @@ import com.wdkl.ncs.android.component.home.service.WdKeepAliveService
|
|
|
import com.wdkl.ncs.android.component.home.util.MediaPlayHelper
|
|
|
import com.wdkl.ncs.android.component.home.util.SpeechUtil
|
|
|
import com.wdkl.ncs.android.component.home.util.Util
|
|
|
+import com.wdkl.ncs.android.component.nursehome.common.Constants.Companion.ttsState
|
|
|
import com.wdkl.ncs.android.lib.base.BaseActivity
|
|
|
-import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
|
import com.wdkl.ncs.android.lib.utils.AppTool
|
|
|
import com.wdkl.ncs.android.lib.utils.showMessage
|
|
|
import com.wdkl.ncs.android.middleware.logic.contract.home.NewEventListContract
|
|
@@ -64,8 +63,8 @@ class NewEventListActivity : BaseActivity<NewEventListPresenter,ActivityEventLis
|
|
|
|
|
|
override fun init() {
|
|
|
//TTS初始化
|
|
|
-// SpeechUtil.getInstance().init(BaseApplication.appContext)
|
|
|
-// SpeechUtil.getInstance().startSpeechThread()
|
|
|
+ SpeechUtil.getInstance().init(this)
|
|
|
+ SpeechUtil.getInstance().startSpeechThread()
|
|
|
|
|
|
WdKeepAliveService.mNewEventListActive = true
|
|
|
//震动
|
|
@@ -81,11 +80,27 @@ class NewEventListActivity : BaseActivity<NewEventListPresenter,ActivityEventLis
|
|
|
if (tcpModel.type == TcpType.EVENT && tcpModel.action == TcpAction.EventAction.KEY_CLICK) {
|
|
|
val eventStr = Util.appendSpace(interactionVO.fromFrameFullName.replace("-", ",")) + ", " + interactionVO.data
|
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
|
- SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
|
|
|
+ AppTool.Time.delay(200) {
|
|
|
+ var count = 1;
|
|
|
+ while (ttsState == 0 && count<6){
|
|
|
+ count++
|
|
|
+ Thread.sleep(500)
|
|
|
+ }
|
|
|
+ SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
} else if (tcpModel.type == TcpType.IM && tcpModel.action == TcpAction.IMAction.MSG) {
|
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
|
- SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
|
|
|
+ AppTool.Time.delay(200) {
|
|
|
+ var count = 1;
|
|
|
+ while (ttsState == 0 && count<6){
|
|
|
+ count++
|
|
|
+ Thread.sleep(500)
|
|
|
+ }
|
|
|
+ SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
|
|
|
+ }
|
|
|
+
|
|
|
} else if (tcpModel.type == TcpType.SOS && tcpModel.action == TcpAction.SOSAction.CALL) {
|
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
|
MediaPlayHelper.getInstance().stopMusic()
|
|
@@ -113,7 +128,8 @@ class NewEventListActivity : BaseActivity<NewEventListPresenter,ActivityEventLis
|
|
|
override fun destory() {
|
|
|
MediaPlayHelper.getInstance().stopMusic()
|
|
|
mVibrator.cancel()
|
|
|
- SpeechUtil.getInstance().stopSpeak()
|
|
|
+// SpeechUtil.getInstance().stopSpeak()
|
|
|
+ SpeechUtil.getInstance().release()
|
|
|
WdKeepAliveService.mNewEventListActive = false
|
|
|
}
|
|
|
|
|
@@ -232,14 +248,30 @@ class NewEventListActivity : BaseActivity<NewEventListPresenter,ActivityEventLis
|
|
|
listData.add(responseInteractionVO)
|
|
|
renderData(listData)
|
|
|
val eventStr = Util.appendSpace(responseInteractionVO.fromFrameFullName.replace("-", ",")) + ", " + responseInteractionVO.data
|
|
|
- SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
|
|
|
+ AppTool.Time.delay(200) {
|
|
|
+ var count = 1;
|
|
|
+ while (ttsState == 0 && count<6){
|
|
|
+ count++
|
|
|
+ Thread.sleep(500)
|
|
|
+ }
|
|
|
+ SpeechUtil.getInstance().newSpeech("您有新的事件待处理, " + eventStr, false)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
} else if (tcpModel.type == TcpType.IM){
|
|
|
if (tcpModel.action == TcpAction.IMAction.MSG) {
|
|
|
handleVibrator()
|
|
|
listData.add(responseInteractionVO)
|
|
|
renderData(listData)
|
|
|
- SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
|
|
|
+ AppTool.Time.delay(200) {
|
|
|
+ var count = 1;
|
|
|
+ while (ttsState == 0 && count<6){
|
|
|
+ count++
|
|
|
+ Thread.sleep(500)
|
|
|
+ }
|
|
|
+ SpeechUtil.getInstance().newSpeech("您有新的语音留言待处理", false)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
} else if (messageEvent.tag == 999){ //SOS
|