|
|
@ -237,16 +237,23 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea |
|
|
|
|
|
|
|
|
|
|
|
override fun loadContentFinish(bookChapter: BookChapter, content: String) { |
|
|
|
override fun loadContentFinish(bookChapter: BookChapter, content: String) { |
|
|
|
launch { |
|
|
|
launch { |
|
|
|
if (viewModel.durChapterIndex == bookChapter.index) { |
|
|
|
when (bookChapter.index) { |
|
|
|
tv_chapter_name.text = bookChapter.title |
|
|
|
viewModel.durChapterIndex -> { |
|
|
|
tv_chapter_name.visible() |
|
|
|
tv_chapter_name.text = bookChapter.title |
|
|
|
if (!viewModel.isLocalBook) { |
|
|
|
tv_chapter_name.visible() |
|
|
|
tv_chapter_url.text = bookChapter.url |
|
|
|
if (!viewModel.isLocalBook) { |
|
|
|
tv_chapter_url.visible() |
|
|
|
tv_chapter_url.text = bookChapter.url |
|
|
|
|
|
|
|
tv_chapter_url.visible() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
viewModel.curTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
viewModel.durChapterIndex - 1 -> { |
|
|
|
|
|
|
|
viewModel.prevTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
viewModel.durChapterIndex + 1 -> { |
|
|
|
|
|
|
|
viewModel.nextTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
val textChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) |
|
|
|
|
|
|
|
content_text_view.text = textChapter.pages[0].stringBuilder |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|