Sfoglia il codice sorgente

<修改TTS语音播报模式>

weizhengliang 4 anni fa
parent
commit
935c735556

+ 5 - 15
app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingBedFragment.java

@@ -1871,6 +1871,9 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
     private synchronized void startSpeak(UdpEntity entity) {
         //是否要播报"房": 0--不要  1--要  2--"房"和"床"都不要
         String tag = SharedPreferencesUtil.getStringSp(getActivity(), Constants.MSG_SP, Constants.VOICE_BROADCAST_TAG);
+        if ("2".equals(tag)) {
+            return;
+        }
 
         loopingUdpentity = entity;
         showUrgentWindow(entity);
@@ -1880,11 +1883,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         String text = "";
         switch (type) {
             case DOOR_CALL: //门口机
-                if ("0".equals(tag) || "2".equals(tag)) {
-                    text = rnb + "门口机呼叫";
-                } else if ("1".equals(tag)) {
-                    text = rnb + "房门口机呼叫";
-                }
+                text = rnb + "房门口机呼叫";
                 break;
             case Constants.MAIN_CALL://主机
                 text = rnb + "主机呼叫";
@@ -1895,8 +1894,6 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     text = bnb + "床呼叫";
                 } else if ("1".equals(tag)) {
                     text = rnb + "房" + bnb + "床呼叫";
-                } else if ("2".equals(tag)) {
-                    text = bnb + "呼叫";
                 }
                 break;
             case Constants.ROOMHELP_CALL://请求增援
@@ -1904,17 +1901,10 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     text = bnb + "床请求增援";
                 } else if ("1".equals(tag)) {
                     text = rnb + "房" + bnb + "床请求增援";
-                } else if ("2".equals(tag)) {
-                    text = bnb + "请求增援";
                 }
                 break;
             case Constants.WSHROOM_CALL://卫生间
-                if ("0".equals(tag) || "2".equals(tag)) {
-                    text = rnb + "卫生间请求增援";
-                } else if ("1".equals(tag)) {
-                    text = rnb + "房卫生间请求增援";
-                }
-
+                text = rnb + "房卫生间紧急呼叫";
                 break;
             case Constants.MANAGER_CALL://总控机
                 text = "总控制室呼叫";

+ 4 - 4
app/src/main/java/com/wdkl/callingmainnurse/util/SpeechUtil.java

@@ -57,13 +57,13 @@ public class SpeechUtil {
     }
 
     public void newSpeech(String text) {
-        //LogUtil.d(TAG, "add text speech: " + text);
+        LogUtil.d(TAG, "add text speech: " + text);
         speechTextList.add(text);
         startSpeechThread();
     }
 
     public synchronized void speak(final String text) {
-        //LogUtil.d(TAG, "start speak");
+        LogUtil.d(TAG, "start speak");
         isStop = false;
         textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, "uniqueId");
         textToSpeech.setOnUtteranceProgressListener(new UtteranceProgressListener() {
@@ -99,7 +99,7 @@ public class SpeechUtil {
             speechTextList.clear();
             isStop = true;
             speakIndex = 0;
-            //LogUtil.d(TAG, "stop speak");
+            LogUtil.d(TAG, "stop speak");
         }
     }
 
@@ -132,7 +132,7 @@ public class SpeechUtil {
             while (isSpeechLoop) {
                 if (speechTextList.size() > 0 && isStop) {
                     String speech = speechTextList.get(0);
-                    //LogUtil.d(TAG, "speech: " + speech);
+                    LogUtil.d(TAG, "speech: " + speech);
                     speak(speech);
 
                     if (speechTextList.contains(speech)) {