添加单章换源
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user