悬浮窗修改

This commit is contained in:
18401019693 2022-10-22 16:27:12 +08:00
parent a82d3984fa
commit 60a132489a
4 changed files with 60 additions and 57 deletions

View File

@ -30,7 +30,7 @@ import java.util.Locale;
import java.util.Random; import java.util.Random;
public class Recognizer extends RelativeLayout implements RecognizerListener { public class Recognizer extends RelativeLayout {
private static final String TAG = "Recognizer"; private static final String TAG = "Recognizer";
private ImageView imgMic; private ImageView imgMic;
@ -104,17 +104,17 @@ public class Recognizer extends RelativeLayout implements RecognizerListener {
}; };
public void startRecognize() { public void startRecognize() {
if (null == mIat) { // if (null == mIat) {
mIat = SpeechRecognizer.createRecognizer(getContext(), mInitListener); // mIat = SpeechRecognizer.createRecognizer(getContext(), mInitListener);
} // }
if (mIat.isListening()) { // if (mIat.isListening()) {
return; // return;
} // }
setParam(); // setParam();
int ret = mIat.startListening(this); // int ret = mIat.startListening(this);
if (ret != ErrorCode.SUCCESS) { // if (ret != ErrorCode.SUCCESS) {
Log.e(TAG, "startRecognize ret error " + ret); // Log.e(TAG, "startRecognize ret error " + ret);
} // }
} }
/** /**
@ -267,50 +267,50 @@ public class Recognizer extends RelativeLayout implements RecognizerListener {
mResultCallBack.onResult(text); mResultCallBack.onResult(text);
} }
} }
//
@Override // @Override
public void onResult(RecognizerResult recognizerResult, boolean b) { // public void onResult(RecognizerResult recognizerResult, boolean b) {
printResult(recognizerResult); // printResult(recognizerResult);
if (imgMic != null) { // if (imgMic != null) {
imgMic.setImageResource(R.mipmap.rc_recognize_disable); // imgMic.setImageResource(R.mipmap.rc_recognize_disable);
} // }
} // }
//
@Override // @Override
public void onError(SpeechError speechError) { // public void onError(SpeechError speechError) {
if (speechError.getErrorCode() == ErrorCode.ERROR_NO_NETWORK) { // if (speechError.getErrorCode() == ErrorCode.ERROR_NO_NETWORK) {
Toast.makeText( // Toast.makeText(
getContext(), // getContext(),
getContext().getString(R.string.load_failure), // getContext().getString(R.string.load_failure),
Toast.LENGTH_SHORT) // Toast.LENGTH_SHORT)
.show(); // .show();
} // }
if (imgMic != null) { // if (imgMic != null) {
imgMic.setImageResource(R.mipmap.rc_recognize_disable); // imgMic.setImageResource(R.mipmap.rc_recognize_disable);
} // }
} // }
//
@Override // @Override
public void onEvent(int eventType, int i1, int i2, Bundle bundle) { // public void onEvent(int eventType, int i1, int i2, Bundle bundle) {
Log.e(TAG, "RecognizerView onEvent eventType: " + eventType); // Log.e(TAG, "RecognizerView onEvent eventType: " + eventType);
} // }
//
@Override // @Override
public void onVolumeChanged(int volume, byte[] bytes) { // public void onVolumeChanged(int volume, byte[] bytes) {
changeVolume(volume); // changeVolume(volume);
} // }
//
@Override // @Override
public void onBeginOfSpeech() { // public void onBeginOfSpeech() {
Log.e(TAG, "RecognizerView onBeginOfSpeech"); // Log.e(TAG, "RecognizerView onBeginOfSpeech");
beginOfSpeech(); // beginOfSpeech();
} // }
//
@Override // @Override
public void onEndOfSpeech() { // public void onEndOfSpeech() {
Log.e(TAG, "RecognizerView onEndOfSpeech"); // Log.e(TAG, "RecognizerView onEndOfSpeech");
endOfSpeech(); // endOfSpeech();
} // }
public void setCallBack(IRecognizedResult resultCallBack) { public void setCallBack(IRecognizedResult resultCallBack) {
mResultCallBack = resultCallBack; mResultCallBack = resultCallBack;

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

View File

@ -67,6 +67,7 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.VerticalPagerAdapter; import com.yunbao.live.adapter.VerticalPagerAdapter;
@ -183,7 +184,8 @@ public class LiveAudienceActivity extends LiveActivity {
if (EasyFloat.isShow("LiveFloatView")) { if (EasyFloat.isShow("LiveFloatView")) {
EasyFloat.dismiss("LiveFloatView", true); EasyFloat.dismiss("LiveFloatView", true);
} }
IMLoginManager.get(mContext).initISHint(); APPEasyFloat.getInstance().dismiss(mContext);
IMLoginManager.get(mContext).initISHint();
} }
public void setBackIndex(int backIndex) { public void setBackIndex(int backIndex) {

View File

@ -42,6 +42,7 @@ public class HintDialog extends AbsDialogFragment {
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
IMLoginManager.get(mContext).initISHint();
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {