From 4d625b8f7d4eb22209dba53cf19353d8aa7455ea Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期二, 10 三月 2020 17:47:13 +0800
Subject: [PATCH] 修改TTS播放。

---
 lib/src/main/java/com/anyun/exam/lib/RemoteService.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
index bc33c8a..2712b49 100644
--- a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
+++ b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -13,6 +13,7 @@
 import com.anyun.exam.lib.util.DESUtil;
 import com.anyun.exam.lib.util.NetUtils;
 import com.anyun.exam.lib.util.Speaker;
+import com.anyun.exam.lib.util.SpeakerCallback;
 
 import androidx.annotation.Nullable;
 
@@ -78,7 +79,7 @@
     public void onCreate() {
         super.onCreate();
         Log.i(TAG,"onCreate()");
-        speaker = new Speaker(getApplicationContext());
+        speaker = new Speaker(/*getApplicationContext()*/this, new TTSCallback());
 
         new Thread(new StartNative()).start();
 
@@ -93,7 +94,6 @@
             } catch (InterruptedException e) {
 
             }
-            ttsInitSucc = true;
         }
     }
 
@@ -186,6 +186,29 @@
         return h.toString();
     }
 
+    class TTSCallback implements SpeakerCallback {
+        @Override
+        public void PlayInit(boolean ret) {
+            Log.d(TAG, "TTS寮曟搸鍒濆鍖栨垚鍔�");
+            ttsInitSucc = ret;
+        }
+
+        @Override
+        public void PlayStart() {
+            Log.d(TAG, "TTS寮曟搸鎾斁寮�濮�");
+        }
+
+        @Override
+        public void PlayDone() {
+            Log.d(TAG, "TTS寮曟搸鎾斁缁撴潫");
+        }
+
+        @Override
+        public void PlayError() {
+            Log.d(TAG, "TTS寮曟搸鎾斁鍑洪敊");
+        }
+    }
+
     // Used to load the 'native-lib' library on application startup.
     static {
         System.loadLibrary("native-lib");

--
Gitblit v1.8.0