From de369e3b72abaa14149514ffc335db779ae32169 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 24 Feb 2020 12:30:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/service/help/ReadBook.kt | 6 ++++++ .../io/legado/app/ui/book/read/ReadBookActivity.kt | 6 ------ .../io/legado/app/ui/book/read/page/PageView.kt | 13 +------------ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/service/help/ReadBook.kt index d038ad600..4e718a09c 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/service/help/ReadBook.kt @@ -127,6 +127,12 @@ object ReadBook { saveRead() } + fun setPageIndex(pageIndex: Int) { + durPageIndex = pageIndex + saveRead() + curPageChanged() + } + fun curPageChanged() { callBack?.upPageProgress() if (BaseReadAloudService.isRun) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 3ba0c965c..a10e21f74 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -505,12 +505,6 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo viewModel.changeTo(book) } - override fun setPageIndex(pageIndex: Int) { - ReadBook.durPageIndex = pageIndex - ReadBook.saveRead() - ReadBook.curPageChanged() - } - override fun clickCenter() { if (BaseReadAloudService.isRun) { showReadAloudDialog() diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index a4841e3f0..7ebb215ce 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -168,7 +168,7 @@ class PageView(context: Context, attrs: AttributeSet) : get() = ReadBook.durChapterPos() override fun setPageIndex(pageIndex: Int) { - callBack.setPageIndex(pageIndex) + ReadBook.setPageIndex(pageIndex) } override fun getChapterPosition(): Int { @@ -196,19 +196,8 @@ class PageView(context: Context, attrs: AttributeSet) : } interface CallBack { - val isInitFinish: Boolean - - /** - * 保存页数 - */ - fun setPageIndex(pageIndex: Int) - - /** - * 点击屏幕中间 - */ fun clickCenter() - fun screenOffTimerStart() } }