|
@@ -12,14 +12,12 @@ import com.alibaba.android.arouter.launcher.ARouter
|
|
|
import com.bumptech.glide.Glide
|
|
|
import com.tencent.imsdk.v2.*
|
|
|
import com.tencent.qcloud.tuikit.tuichat.bean.message.PatientStartConsultationBean
|
|
|
-import com.yingyang.home.BuildConfig
|
|
|
import com.yingyang.home.R
|
|
|
import com.yingyang.home.databinding.ActivityHomeBinding
|
|
|
import com.yingyangfly.baselib.bean.MessageBean
|
|
|
import com.yingyangfly.baselib.bean.PurchaseConsultationEvent
|
|
|
import com.yingyangfly.baselib.bean.Record
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
-import com.yingyangfly.baselib.dialog.MessageDialog
|
|
|
import com.yingyangfly.baselib.dialog.TipsDialog
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
@@ -594,18 +592,13 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
|
|
|
* 语音合成
|
|
|
*/
|
|
|
private fun speak(desn: String) {
|
|
|
- if (db != null) {
|
|
|
- val voicePlayerDao = db?.getVoicePlayerDao()
|
|
|
- if (voicePlayerDao != null) {
|
|
|
- val voicePlayerBean = voicePlayerDao.getVoicePlayerBean(desn)
|
|
|
- if (voicePlayerBean != null) {
|
|
|
- if (voicePlayer != null) {
|
|
|
- voicePlayer?.play(voicePlayerBean.url) {
|
|
|
- LiveEventBusUtil.send(RxBusCodes.STARTMUSIC, "")
|
|
|
- }
|
|
|
+ if (voicePlayerDao != null) {
|
|
|
+ val voicePlayerBean = voicePlayerDao?.getVoicePlayerBean(desn)
|
|
|
+ if (voicePlayerBean != null) {
|
|
|
+ if (voicePlayer != null) {
|
|
|
+ voicePlayer?.play(voicePlayerBean.url) {
|
|
|
+ LiveEventBusUtil.send(RxBusCodes.STARTMUSIC, "")
|
|
|
}
|
|
|
- } else {
|
|
|
- getVoiceUrl(desn)
|
|
|
}
|
|
|
} else {
|
|
|
getVoiceUrl(desn)
|
|
@@ -621,15 +614,12 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
|
|
|
private fun getVoiceUrl(taskDesn: String) {
|
|
|
viewModel.getVoiceUrl(taskDesn, fail = {}, success = {
|
|
|
if (TextUtils.isEmpty(it).not()) {
|
|
|
- if (db != null) {
|
|
|
- val voicePlayerDao = db?.getVoicePlayerDao()
|
|
|
- if (voicePlayerDao != null) {
|
|
|
- val voicePlayerBean = VoicePlayerBean().apply {
|
|
|
- url = it
|
|
|
- words = taskDesn
|
|
|
- }
|
|
|
- voicePlayerDao.insert(voicePlayerBean)
|
|
|
+ if (voicePlayerDao != null) {
|
|
|
+ val voicePlayerBean = VoicePlayerBean().apply {
|
|
|
+ url = it
|
|
|
+ words = taskDesn
|
|
|
}
|
|
|
+ voicePlayerDao?.insert(voicePlayerBean)
|
|
|
}
|
|
|
if (voicePlayer != null) {
|
|
|
voicePlayer?.play(it) {
|