保存的tts引擎正在朗读时更新下;要登录的tts引擎被选中时弹出登录界面

pull/1610/head
Xwite 3 years ago
parent b3292ae6c4
commit 40be241164
  1. 1
      app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt
  2. 10
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt

@ -37,6 +37,7 @@ class HttpTtsEditViewModel(app: Application) : BaseViewModel(app) {
id = httpTTS.id
execute {
appDb.httpTTSDao.insert(httpTTS)
if (ReadAloud.ttsEngine == httpTTS.id.toString()) ReadAloud.upReadAloudClass()
}.onSuccess {
success?.invoke()
}

@ -26,6 +26,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.model.ReadAloud
import io.legado.app.model.ReadBook
import io.legado.app.ui.document.HandleFileContract
import io.legado.app.ui.login.SourceLoginActivity
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.launch
@ -217,7 +218,14 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
binding.run {
cbName.setOnClickListener {
getItemByLayoutPosition(holder.layoutPosition)?.let { httpTTS ->
upTts(httpTTS.id.toString())
val id = httpTTS.id.toString()
upTts(id)
if (!httpTTS.loginUrl.isNullOrBlank()) {
startActivity<SourceLoginActivity> {
putExtra("type", "httpTts")
putExtra("key", id)
}
}
}
}
ivEdit.setOnClickListener {

Loading…
Cancel
Save