From 60a132489a739d7d34cd97afc7b0772d1f33ea69 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 22 Oct 2022 16:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=AC=E6=B5=AE=E7=AA=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/weight/Recognizer.java | 112 +++++++++--------- .../src/main/res/mipmap-xxhdpi/icon_voice.png | Bin 0 -> 660 bytes .../live/activity/LiveAudienceActivity.java | 4 +- .../com/yunbao/main/dialog/HintDialog.java | 1 + 4 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 common/src/main/res/mipmap-xxhdpi/icon_voice.png diff --git a/common/src/main/java/com/yunbao/common/views/weight/Recognizer.java b/common/src/main/java/com/yunbao/common/views/weight/Recognizer.java index 1a528aa90..a4c141ce4 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/Recognizer.java +++ b/common/src/main/java/com/yunbao/common/views/weight/Recognizer.java @@ -30,7 +30,7 @@ import java.util.Locale; import java.util.Random; -public class Recognizer extends RelativeLayout implements RecognizerListener { +public class Recognizer extends RelativeLayout { private static final String TAG = "Recognizer"; private ImageView imgMic; @@ -104,17 +104,17 @@ public class Recognizer extends RelativeLayout implements RecognizerListener { }; public void startRecognize() { - if (null == mIat) { - mIat = SpeechRecognizer.createRecognizer(getContext(), mInitListener); - } - if (mIat.isListening()) { - return; - } - setParam(); - int ret = mIat.startListening(this); - if (ret != ErrorCode.SUCCESS) { - Log.e(TAG, "startRecognize ret error " + ret); - } +// if (null == mIat) { +// mIat = SpeechRecognizer.createRecognizer(getContext(), mInitListener); +// } +// if (mIat.isListening()) { +// return; +// } +// setParam(); +// int ret = mIat.startListening(this); +// if (ret != ErrorCode.SUCCESS) { +// Log.e(TAG, "startRecognize ret error " + ret); +// } } /** @@ -267,50 +267,50 @@ public class Recognizer extends RelativeLayout implements RecognizerListener { mResultCallBack.onResult(text); } } - - @Override - public void onResult(RecognizerResult recognizerResult, boolean b) { - printResult(recognizerResult); - if (imgMic != null) { - imgMic.setImageResource(R.mipmap.rc_recognize_disable); - } - } - - @Override - public void onError(SpeechError speechError) { - if (speechError.getErrorCode() == ErrorCode.ERROR_NO_NETWORK) { - Toast.makeText( - getContext(), - getContext().getString(R.string.load_failure), - Toast.LENGTH_SHORT) - .show(); - } - if (imgMic != null) { - imgMic.setImageResource(R.mipmap.rc_recognize_disable); - } - } - - @Override - public void onEvent(int eventType, int i1, int i2, Bundle bundle) { - Log.e(TAG, "RecognizerView onEvent eventType: " + eventType); - } - - @Override - public void onVolumeChanged(int volume, byte[] bytes) { - changeVolume(volume); - } - - @Override - public void onBeginOfSpeech() { - Log.e(TAG, "RecognizerView onBeginOfSpeech"); - beginOfSpeech(); - } - - @Override - public void onEndOfSpeech() { - Log.e(TAG, "RecognizerView onEndOfSpeech"); - endOfSpeech(); - } +// +// @Override +// public void onResult(RecognizerResult recognizerResult, boolean b) { +// printResult(recognizerResult); +// if (imgMic != null) { +// imgMic.setImageResource(R.mipmap.rc_recognize_disable); +// } +// } +// +// @Override +// public void onError(SpeechError speechError) { +// if (speechError.getErrorCode() == ErrorCode.ERROR_NO_NETWORK) { +// Toast.makeText( +// getContext(), +// getContext().getString(R.string.load_failure), +// Toast.LENGTH_SHORT) +// .show(); +// } +// if (imgMic != null) { +// imgMic.setImageResource(R.mipmap.rc_recognize_disable); +// } +// } +// +// @Override +// public void onEvent(int eventType, int i1, int i2, Bundle bundle) { +// Log.e(TAG, "RecognizerView onEvent eventType: " + eventType); +// } +// +// @Override +// public void onVolumeChanged(int volume, byte[] bytes) { +// changeVolume(volume); +// } +// +// @Override +// public void onBeginOfSpeech() { +// Log.e(TAG, "RecognizerView onBeginOfSpeech"); +// beginOfSpeech(); +// } +// +// @Override +// public void onEndOfSpeech() { +// Log.e(TAG, "RecognizerView onEndOfSpeech"); +// endOfSpeech(); +// } public void setCallBack(IRecognizedResult resultCallBack) { mResultCallBack = resultCallBack; diff --git a/common/src/main/res/mipmap-xxhdpi/icon_voice.png b/common/src/main/res/mipmap-xxhdpi/icon_voice.png new file mode 100644 index 0000000000000000000000000000000000000000..2ea9d64e53ea557e87891b4e9e6164db4882ca22 GIT binary patch literal 660 zcmV;F0&D$=P)Px%PDw;TR7gwhmP@EkVHAd+myujT8JV~olv~JQq%al9ZA8jtXuynOKrwR$hAt&W zZi!4$MlK<@!f}p?kwPvR@oJsEU;p{f-uv7CW_VV8?b`qPzjv>9t?zqZQ8R2$1NH&y zf!XPA?|_@YDM=seY^6F$wl@RkfJr6!Ux8hcuIBd30w%Caz?f7`AMh}3+zaeaRsROI zf<-4o78@HdN7N`$nqtn4}|RxjDcmz!G4s zq&peFHNb7)sidV%0fVB6u_S%Z08RkD#gbGuT;wWrfJn*?SLE5w=8pnqDQfTQD5XOK z*g;8*c1-2a5vW5^6{WU^?NACI3SDWocz%$^bq=jXG7l7@+0ZDzf8(-eGL$*!=7bWc|1Ka{! z1|CW3{TF$%9h$iu*edBt8Q?hJEik>6*hGMBw?6y>Fh|nQLclbcdw|nGc$5{A-gjd$ zY|j850O5i5N;=bibVgj>w!=zXPh$E8SSP8!j)}6}1Ka}UCOfiGQdp0_QK%NSLj&&u z%YZm4VIj^+`c+~v#sa&6upn^+9s{c-g+308QhBmH9ykw#V~ZFB!j;_vqBjxI>s2Xd zW_lMnJ0<-n`nasH+TN55(!8P#+TOhe!f0Kq%F6<#L5jYv1j0zoPtW)%jMJ<1yx-Zc uMirLytSg<&4o!x-P?6|k-15=CuHp|_nMN#RCXoFA0000