添加了接口控制文字消息和语音的展示

This commit is contained in:
18401019693 2024-01-15 16:15:00 +08:00
parent 58b2d69601
commit 2aa50ecfc7
2 changed files with 29 additions and 32 deletions

View File

@ -48,7 +48,7 @@ public class SudGameSmallPopupPindow extends AttachPopupView {
return; return;
} }
if (sudGameUserModel.getMicStatus() == 3) { if (sudGameUserModel.getMicStatus() == 3) {
ToastUtil.show("对方未开麦!"); ToastUtil.show(WordUtil.isNewZh() ? "對方未開麥!" : "The other side did not turn on the microphone");
return; return;
} }
if (!mute) { if (!mute) {

View File

@ -126,20 +126,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
gameCloseWheat.setVisibility(View.INVISIBLE); gameCloseWheat.setVisibility(View.INVISIBLE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
ToastUtil.show("拒绝权限将无法使用上麦功能");
mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
@Override
public void run() {
}
});
}
}
}, 1500);
mProcessResultUtil = new ProcessResultUtil(this); mProcessResultUtil = new ProcessResultUtil(this);
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() { .getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() {
@ -151,13 +138,24 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
//语音 //语音
if (TextUtils.equals(data.getMicStatus(), "1")) { if (TextUtils.equals(data.getMicStatus(), "1")) {
imOff = true; imOff = true;
gameCloseWheat.setVisibility(View.VISIBLE);
gameSeat.setVisibility(View.VISIBLE); gameSeat.setVisibility(View.VISIBLE);
userList.setVisibility(View.VISIBLE); userList.setVisibility(View.VISIBLE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
ToastUtil.show("拒绝权限将无法使用上麦功能");
mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
@Override
public void run() {
}
});
}
}
}, 1500);
} else { } else {
imOff = false; imOff = false;
gameCloseWheat.setVisibility(View.GONE);
gameSeat.setVisibility(View.GONE); gameSeat.setVisibility(View.GONE);
userList.setVisibility(View.GONE); userList.setVisibility(View.GONE);
} }
@ -189,25 +187,24 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
@Override @Override
protected void onDestroy() { protected void onDestroy() {
LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
if (gameMicManager != null) { if (gameMicManager != null) {
gameMicManager.leaveRoom(); gameMicManager.leaveRoom();
gameMicManager.detachView(); gameMicManager.detachView();
} }
if (imOff) {
LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
Bus.getOff(this); Bus.getOff(this);
super.onDestroy(); super.onDestroy();