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

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

Loading…
Cancel
Save