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

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,6 +126,20 @@ 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);
mProcessResultUtil = new ProcessResultUtil(this);
LiveNetManager.get(mContext)
.getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() {
@Override
public void onSuccess(RoomMicStatusModel data) {
gameMicManager = new GameMicManager();
gameMicManager.attachView(SudGameActivity.this);
gameMicManager.config(SudGameActivity.this);
//语音
if (TextUtils.equals(data.getMicStatus(), "1")) {
imOff = true;
gameSeat.setVisibility(View.VISIBLE);
userList.setVisibility(View.VISIBLE);
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -140,24 +154,8 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
} }
}, 1500); }, 1500);
mProcessResultUtil = new ProcessResultUtil(this);
LiveNetManager.get(mContext)
.getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() {
@Override
public void onSuccess(RoomMicStatusModel data) {
gameMicManager = new GameMicManager();
gameMicManager.attachView(SudGameActivity.this);
gameMicManager.config(SudGameActivity.this);
//语音
if (TextUtils.equals(data.getMicStatus(), "1")) {
imOff = true;
gameCloseWheat.setVisibility(View.VISIBLE);
gameSeat.setVisibility(View.VISIBLE);
userList.setVisibility(View.VISIBLE);
} 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,11 +187,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
@Override @Override
protected void onDestroy() { protected void onDestroy() {
if (gameMicManager != null) {
gameMicManager.leaveRoom();
gameMicManager.detachView();
}
if (imOff) {
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() { .leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override @Override
@ -206,8 +200,11 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
}); });
}
if (gameMicManager != null) {
gameMicManager.leaveRoom();
gameMicManager.detachView();
}
Bus.getOff(this); Bus.getOff(this);
super.onDestroy(); super.onDestroy();