pull/32/head
kunfei 5 years ago
parent aceccb7c5b
commit 47b8cb5e20
  1. 13
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt

@ -124,8 +124,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
} }
override fun skipPreChapter() { override fun skipPreChapter() {
moveToPrevChapter() moveToPrevChapter(false)
viewModel.durPageIndex = 0
page_view.upContent() page_view.upContent()
} }
@ -258,7 +257,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
tv_chapter_url.text = it.url tv_chapter_url.text = it.url
tv_chapter_url.visible() tv_chapter_url.visible()
} }
read_menu.upReadProgress(it.pageSize(), viewModel.durPageIndex) read_menu.upReadProgress(it.pageSize().minus(1), viewModel.durPageIndex)
curPageChanged() curPageChanged()
tv_pre.isEnabled = viewModel.durChapterIndex != 0 tv_pre.isEnabled = viewModel.durChapterIndex != 0
tv_next.isEnabled = viewModel.durChapterIndex != viewModel.chapterSize - 1 tv_next.isEnabled = viewModel.durChapterIndex != viewModel.chapterSize - 1
@ -321,8 +320,12 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
curChapterChanged() curChapterChanged()
} }
override fun moveToPrevChapter() { override fun moveToPrevChapter(last: Boolean) {
viewModel.durPageIndex = viewModel.prevTextChapter?.lastIndex() ?: 0 viewModel.durPageIndex = if (last) {
viewModel.prevTextChapter?.lastIndex() ?: 0
} else {
0
}
viewModel.moveToPrevChapter() viewModel.moveToPrevChapter()
curChapterChanged() curChapterChanged()
} }

@ -192,7 +192,7 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att
fun textChapter(chapterOnDur: Int = 0): TextChapter? fun textChapter(chapterOnDur: Int = 0): TextChapter?
fun loadContent(index: Int) fun loadContent(index: Int)
fun moveToNextChapter() fun moveToNextChapter()
fun moveToPrevChapter() fun moveToPrevChapter(last: Boolean = true)
fun setPageIndex(pageIndex: Int) fun setPageIndex(pageIndex: Int)
fun clickCenter() fun clickCenter()
} }

Loading…
Cancel
Save