pull/1470/head
gedoor 3 years ago
parent e27906e1ec
commit f8906cc9dd
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt
  2. 1
      app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditViewModel.kt

@ -81,7 +81,9 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit),
override fun onMenuItemClick(item: MenuItem?): Boolean { override fun onMenuItemClick(item: MenuItem?): Boolean {
when (item?.itemId) { when (item?.itemId) {
R.id.menu_save -> viewModel.save(dataFromView()) R.id.menu_save -> viewModel.save(dataFromView()) {
toastOnUi("保存成功")
}
R.id.menu_login -> dataFromView().let { httpTts -> R.id.menu_login -> dataFromView().let { httpTts ->
if (httpTts.loginUrl.isNullOrBlank()) { if (httpTts.loginUrl.isNullOrBlank()) {
toastOnUi("登录url不能为空") toastOnUi("登录url不能为空")

@ -31,6 +31,7 @@ class HttpTtsEditViewModel(app: Application) : BaseViewModel(app) {
} }
fun save(httpTTS: HttpTTS, success: (() -> Unit)? = null) { fun save(httpTTS: HttpTTS, success: (() -> Unit)? = null) {
id = httpTTS.id
execute { execute {
appDb.httpTTSDao.insert(httpTTS) appDb.httpTTSDao.insert(httpTTS)
ReadAloud.upReadAloudClass() ReadAloud.upReadAloudClass()

Loading…
Cancel
Save