修复语音朗读部分bug

pull/5/head
fengyuecanzhu 4 years ago
parent 566b551472
commit 5a5e5d3cea
  1. 2
      app/src/main/java/xyz/fycz/myreader/application/MyApplication.java
  2. 11
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  3. 2
      app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java
  4. 2
      app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java
  5. 2
      app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java

@ -254,7 +254,7 @@ public class MyApplication extends Application {
MyApplication.getApplication().newThread(() -> { MyApplication.getApplication().newThread(() -> {
Document doc = null; Document doc = null;
try { try {
String url = "https://shimo.im/docs/cqkgjPRRydYYhQKt/read"; String url = "https://shimo.im/docs/JzVpMgbZUJARSaFs/read";
if (isApkInDebug(getmContext())) { if (isApkInDebug(getmContext())) {
url = "https://shimo.im/docs/zfzpda7MUGskOC9v/read"; url = "https://shimo.im/docs/zfzpda7MUGskOC9v/read";
} }

@ -397,18 +397,21 @@ public class ReadActivity extends BaseActivity {
@Override @Override
public void onPageChange(int pos, boolean resetRead) { public void onPageChange(int pos, boolean resetRead) {
mHandler.sendMessage(mHandler.obtainMessage(4)); mHandler.sendMessage(mHandler.obtainMessage(4));
if ((ReadAloudService.running)) { if (ReadAloudService.running) {
if (mPageLoader.hasChapterData(mChapters.get(mPageLoader.getChapterPos()))) {
if (resetRead) { if (resetRead) {
if (mAudioPlayerDialog != null) { if (mAudioPlayerDialog != null) {
mHandler.postDelayed(() ->mAudioPlayerDialog.readAloud(), 500); mHandler.postDelayed(() -> mAudioPlayerDialog.readAloud(), 500);
} }
return; return;
} }
if (pos == 0) { if (pos == 0) {
if (mAudioPlayerDialog != null) { if (mAudioPlayerDialog != null) {
mHandler.postDelayed(() ->mAudioPlayerDialog.readAloud(), 500); mHandler.postDelayed(() -> mAudioPlayerDialog.readAloud(), 500);
} }
return; }
}else {
ReadAloudService.stop(ReadActivity.this);
} }
} }
} }

@ -395,7 +395,7 @@ public class LocalPageLoader extends PageLoader {
@Override @Override
protected boolean hasChapterData(Chapter chapter) { public boolean hasChapterData(Chapter chapter) {
return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle()); return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle());
} }

@ -92,7 +92,7 @@ public class NetPageLoader extends PageLoader {
} }
@Override @Override
protected boolean hasChapterData(Chapter chapter) { public boolean hasChapterData(Chapter chapter) {
return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle()); return ChapterService.isChapterCached(mCollBook.getId(), chapter.getTitle());
} }

@ -857,7 +857,7 @@ public abstract class PageLoader {
* *
* @return * @return
*/ */
protected abstract boolean hasChapterData(Chapter chapter); public abstract boolean hasChapterData(Chapter chapter);
/** /**

Loading…
Cancel
Save