添加单章换源

pull/1649/head
kunfei 3 years ago
parent 54df563eb5
commit 2a50ecd788
  1. 5
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt

@ -62,7 +62,9 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
binding.recyclerViewToc.scrollToPosition(tocAdapter.durChapterIndex - 5) binding.recyclerViewToc.scrollToPosition(tocAdapter.durChapterIndex - 5)
} }
private val contentSuccess: (content: String) -> Unit = { private val contentSuccess: (content: String) -> Unit = {
binding.loadingToc.hide()
callBack?.replaceContent(it) callBack?.replaceContent(it)
dismissAllowingStateLoss()
} }
private val searchBookAdapter by lazy { private val searchBookAdapter by lazy {
ChangeChapterSourceAdapter(requireContext(), viewModel, this) ChangeChapterSourceAdapter(requireContext(), viewModel, this)
@ -265,7 +267,10 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
override fun clickChapter(bookChapter: BookChapter, nextChapterUrl: String?) { override fun clickChapter(bookChapter: BookChapter, nextChapterUrl: String?) {
searchBook?.let { searchBook?.let {
binding.loadingToc.show()
viewModel.getContent(it.toBook(), bookChapter, nextChapterUrl, contentSuccess) { msg -> viewModel.getContent(it.toBook(), bookChapter, nextChapterUrl, contentSuccess) { msg ->
binding.loadingToc.hide()
binding.clToc.gone()
toastOnUi(msg) toastOnUi(msg)
} }
} }

Loading…
Cancel
Save