From 5a5e5d3cea1bd8bf6f1259acd02351d90a9a1c15 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Thu, 12 Nov 2020 11:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=AD=E9=9F=B3=E6=9C=97?= =?UTF-8?q?=E8=AF=BB=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myreader/application/MyApplication.java | 2 +- .../myreader/ui/activity/ReadActivity.java | 23 +++++++++++-------- .../myreader/widget/page/LocalPageLoader.java | 2 +- .../myreader/widget/page/NetPageLoader.java | 2 +- .../fycz/myreader/widget/page/PageLoader.java | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java b/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java index f1f119e..b16056f 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java +++ b/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java @@ -254,7 +254,7 @@ public class MyApplication extends Application { MyApplication.getApplication().newThread(() -> { Document doc = null; try { - String url = "https://shimo.im/docs/cqkgjPRRydYYhQKt/read"; + String url = "https://shimo.im/docs/JzVpMgbZUJARSaFs/read"; if (isApkInDebug(getmContext())) { url = "https://shimo.im/docs/zfzpda7MUGskOC9v/read"; } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index a2a369f..00a22cf 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -397,18 +397,21 @@ public class ReadActivity extends BaseActivity { @Override public void onPageChange(int pos, boolean resetRead) { mHandler.sendMessage(mHandler.obtainMessage(4)); - if ((ReadAloudService.running)) { - if (resetRead) { - if (mAudioPlayerDialog != null) { - mHandler.postDelayed(() ->mAudioPlayerDialog.readAloud(), 500); + if (ReadAloudService.running) { + if (mPageLoader.hasChapterData(mChapters.get(mPageLoader.getChapterPos()))) { + if (resetRead) { + if (mAudioPlayerDialog != null) { + mHandler.postDelayed(() -> mAudioPlayerDialog.readAloud(), 500); + } + return; } - return; - } - if (pos == 0) { - if (mAudioPlayerDialog != null) { - mHandler.postDelayed(() ->mAudioPlayerDialog.readAloud(), 500); + if (pos == 0) { + if (mAudioPlayerDialog != null) { + mHandler.postDelayed(() -> mAudioPlayerDialog.readAloud(), 500); + } } - return; + }else { + ReadAloudService.stop(ReadActivity.this); } } } diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java index c77827b..a0f4cc7 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java @@ -395,7 +395,7 @@ public class LocalPageLoader extends PageLoader { @Override - protected boolean hasChapterData(Chapter chapter) { + public boolean hasChapterData(Chapter chapter) { return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle()); } diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java index 2b7c008..68920c9 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java @@ -92,7 +92,7 @@ public class NetPageLoader extends PageLoader { } @Override - protected boolean hasChapterData(Chapter chapter) { + public boolean hasChapterData(Chapter chapter) { return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle()); } diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java index 6a2bbfd..1e073e2 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java @@ -857,7 +857,7 @@ public abstract class PageLoader { * * @return */ - protected abstract boolean hasChapterData(Chapter chapter); + public abstract boolean hasChapterData(Chapter chapter); /**