|
|
@@ -21,6 +21,7 @@ import com.yingyangfly.baselib.bean.HertzAudio
|
|
|
import com.yingyangfly.baselib.bean.MessageBean
|
|
|
import com.yingyangfly.baselib.bean.PurchaseConsultationEvent
|
|
|
import com.yingyangfly.baselib.bean.Record
|
|
|
+import com.yingyangfly.baselib.bean.SpeechSynthesis
|
|
|
import com.yingyangfly.baselib.db.DepartmentBean
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
import com.yingyangfly.baselib.dialog.TipsDialog
|
|
|
@@ -37,7 +38,6 @@ import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.player.VoicePlayer
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.*
|
|
|
-import com.yingyangfly.baselib.webview.utils.log
|
|
|
import com.yingyangfly.home.adapter.ExclusiveGameAdapter
|
|
|
import com.yingyangfly.home.adapter.GameAdapter
|
|
|
import com.yingyangfly.home.adapter.HertzAudioAdapter
|
|
|
@@ -637,8 +637,8 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
|
|
|
|
|
|
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)
|
|
|
}
|
|
|
}
|
|
|
@@ -688,9 +688,9 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
|
|
|
/**
|
|
|
* 语音合成
|
|
|
*/
|
|
|
- private fun speak(desn: String) {
|
|
|
+ private fun speak(desn: SpeechSynthesis) {
|
|
|
if (voicePlayerDao != null) {
|
|
|
- val voicePlayerBean = voicePlayerDao?.getVoicePlayerBean(desn)
|
|
|
+ val voicePlayerBean = voicePlayerDao?.getVoicePlayerBean(desn.voiceMsg)
|
|
|
if (voicePlayerBean != null) {
|
|
|
if (voicePlayer != null) {
|
|
|
voicePlayer?.play(voicePlayerBean.url) {
|
|
|
@@ -708,13 +708,13 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
|
|
|
/**
|
|
|
* 获取声音url
|
|
|
*/
|
|
|
- private fun getVoiceUrl(taskDesn: String) {
|
|
|
+ private fun getVoiceUrl(taskDesn: SpeechSynthesis) {
|
|
|
viewModel.getVoiceUrl(taskDesn, fail = {}, success = {
|
|
|
if (TextUtils.isEmpty(it).not()) {
|
|
|
if (voicePlayerDao != null) {
|
|
|
val voicePlayerBean = VoicePlayerBean().apply {
|
|
|
url = it
|
|
|
- words = taskDesn
|
|
|
+ words = taskDesn.voiceMsg
|
|
|
}
|
|
|
voicePlayerDao?.insert(voicePlayerBean)
|
|
|
}
|