From aa329a4667cfdb17695411099b28a16d9cd28bae Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 4 Sep 2019 15:03:56 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/readbook/ReadBookActivity.kt | 2 +- .../io/legado/app/ui/readbook/ReadBookViewModel.kt | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) 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 1d9635ece..7ab90a2f0 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 @@ -355,9 +355,9 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea tv_chapter_url.visible() } read_menu.upReadProgress(it.pageSize().minus(1), viewModel.durPageIndex) - curPageChanged() tv_pre.isEnabled = viewModel.durChapterIndex != 0 tv_next.isEnabled = viewModel.durChapterIndex != viewModel.chapterSize - 1 + curPageChanged() } } diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index 5bfac5ea9..fe1a00201 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -114,7 +114,11 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { curTextChapter = nextTextChapter nextTextChapter = null bookData.value?.let { - loadContent(it, durChapterIndex) + if (curTextChapter == null) { + loadContent(it, durChapterIndex) + } else { + callBack?.upContent() + } loadContent(it, durChapterIndex.plus(1)) launch(IO) { for (i in 2..10) { @@ -133,7 +137,11 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { curTextChapter = prevTextChapter prevTextChapter = null bookData.value?.let { - loadContent(it, durChapterIndex) + if (curTextChapter == null) { + loadContent(it, durChapterIndex) + } else { + callBack?.upContent() + } loadContent(it, durChapterIndex.minus(1)) launch(IO) { for (i in -5..-2) {