pull/32/head
kunfei 5 years ago
parent df30bcafd0
commit 100f002edf
  1. 17
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt

@ -59,7 +59,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
viewModel.chapterListFinish.observe(this, Observer { bookLoadFinish() }) viewModel.chapterListFinish.observe(this, Observer { bookLoadFinish() })
viewModel.initData(intent) viewModel.initData(intent)
savedInstanceState?.let { savedInstanceState?.let {
changeSourceDialog = supportFragmentManager.findFragmentByTag(ChangeSourceDialog.tag) as? ChangeSourceDialog changeSourceDialog =
supportFragmentManager.findFragmentByTag(ChangeSourceDialog.tag) as? ChangeSourceDialog
changeSourceDialog?.callBack = this changeSourceDialog?.callBack = this
} }
setScreenBrightness(getPrefInt("brightness", 100)) setScreenBrightness(getPrefInt("brightness", 100))
@ -114,6 +115,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
override fun skipToPage(page: Int) { override fun skipToPage(page: Int) {
viewModel.durPageIndex = page viewModel.durPageIndex = page
page_view.upContent() page_view.upContent()
if (readAloudStatus == Status.PLAY) {
readAloud()
}
} }
override fun skipPreChapter() { override fun skipPreChapter() {
@ -230,12 +234,12 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
curChapterChange() curChapterChange()
} }
viewModel.durChapterIndex - 1 -> { viewModel.durChapterIndex - 1 -> {
viewModel.prevTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) viewModel.prevTextChapter =
page_view.upContent() ChapterProvider.getTextChapter(content_text_view, bookChapter, content)
} }
viewModel.durChapterIndex + 1 -> { viewModel.durChapterIndex + 1 -> {
viewModel.nextTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) viewModel.nextTextChapter =
page_view.upContent() ChapterProvider.getTextChapter(content_text_view, bookChapter, content)
} }
} }
} }
@ -250,6 +254,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
tv_chapter_url.visible() tv_chapter_url.visible()
} }
read_menu.upReadProgress(it.pageSize(), viewModel.durPageIndex) read_menu.upReadProgress(it.pageSize(), viewModel.durPageIndex)
if (readAloudStatus == Status.PLAY) {
readAloud()
}
} }
} }

Loading…
Cancel
Save