diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index 114b1a2b9..25295a158 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -124,8 +124,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea } override fun skipPreChapter() { - moveToPrevChapter() - viewModel.durPageIndex = 0 + moveToPrevChapter(false) page_view.upContent() } @@ -258,7 +257,7 @@ class ReadBookActivity : VMBaseActivity(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(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() } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt index 0626f0d14..95d37a5da 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt @@ -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() }