|
|
@@ -8,6 +8,7 @@ import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.bumptech.glide.Glide
|
|
|
+import com.yingyangfly.baselib.bean.SpeechSynthesis
|
|
|
import com.yingyangfly.baselib.bean.def.PermissionList
|
|
|
import com.yingyangfly.baselib.db.QuestionsBean
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
@@ -80,8 +81,8 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
|
|
|
private fun initLiveData() {
|
|
|
//语音合成
|
|
|
- LiveEventBusUtil.observer<String>(this, RxBusCodes.SPEECHSYNTHESIS) {
|
|
|
- if (TextUtils.isEmpty(it).not()) {
|
|
|
+ LiveEventBusUtil.observer<SpeechSynthesis>(this, RxBusCodes.SPEECHSYNTHESIS) {
|
|
|
+ if (TextUtils.isEmpty(it.voiceMsg).not()) {
|
|
|
speak(it)
|
|
|
}
|
|
|
}
|
|
|
@@ -99,11 +100,11 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
/**
|
|
|
* 语音合成
|
|
|
*/
|
|
|
- private fun speak(desn: String) {
|
|
|
+ private fun speak(desn: SpeechSynthesis) {
|
|
|
if (db != null) {
|
|
|
val voicePlayerDao = db?.getVoicePlayerDao()
|
|
|
if (voicePlayerDao != null) {
|
|
|
- val voicePlayerBean = voicePlayerDao.getVoicePlayerBean(desn)
|
|
|
+ val voicePlayerBean = voicePlayerDao.getVoicePlayerBean(desn.voiceMsg)
|
|
|
if (voicePlayerBean != null && voicePlayer != null) {
|
|
|
voicePlayer?.play(voicePlayerBean.url) {}
|
|
|
} else {
|
|
|
@@ -120,7 +121,7 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
/**
|
|
|
* 获取声音url
|
|
|
*/
|
|
|
- private fun getVoiceUrl(taskDesn: String) {
|
|
|
+ private fun getVoiceUrl(taskDesn: SpeechSynthesis) {
|
|
|
viewModel.getVoiceUrl(taskDesn, fail = {}, success = {
|
|
|
if (TextUtils.isEmpty(it).not()) {
|
|
|
if (db != null) {
|
|
|
@@ -128,7 +129,7 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
if (voicePlayerDao != null) {
|
|
|
val voicePlayerBean = VoicePlayerBean().apply {
|
|
|
url = it
|
|
|
- words = taskDesn
|
|
|
+ words = taskDesn.voiceMsg
|
|
|
}
|
|
|
voicePlayerDao.insert(voicePlayerBean)
|
|
|
}
|