修复语音朗读部分bug

pull/5/head
fengyuecanzhu 4 years ago
parent 4b30fa834d
commit 187cdf3fb8
  1. 6
      app/src/main/java/xyz/fycz/myreader/ui/dialog/AudioPlayerDialog.java

@ -3,6 +3,7 @@ package xyz.fycz.myreader.ui.dialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -40,6 +41,7 @@ public class AudioPlayerDialog extends Dialog {
private ReadActivity mReadActivity; private ReadActivity mReadActivity;
private boolean aloudNextPage; private boolean aloudNextPage;
public ReadAloudService.Status aloudStatus = ReadAloudService.Status.STOP; public ReadAloudService.Status aloudStatus = ReadAloudService.Status.STOP;
private Handler mHandler = new Handler();
private int volume; private int volume;
private int pitch; private int pitch;
@ -274,12 +276,12 @@ public class AudioPlayerDialog extends Dialog {
case ReadAloudService.READ_ALOUD_START: case ReadAloudService.READ_ALOUD_START:
aloudNextPage = true; aloudNextPage = true;
if (mPageLoader != null) { if (mPageLoader != null) {
mPageLoader.readAloudStart((Integer) event); mHandler.post(() -> mPageLoader.readAloudStart((Integer) event));
} }
break; break;
case ReadAloudService.READ_ALOUD_NUMBER: case ReadAloudService.READ_ALOUD_NUMBER:
if (mPageLoader != null && aloudNextPage) { if (mPageLoader != null && aloudNextPage) {
mPageLoader.readAloudLength((Integer) event); mHandler.post(() -> mPageLoader.readAloudLength((Integer) event));
} }
break; break;
case ReadAloudService.ALOUD_STATE: case ReadAloudService.ALOUD_STATE:

Loading…
Cancel
Save