From 54693c0d3794fa52a09b9ac9a3b0d605f330a4a9 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 15 Jan 2024 13:33:53 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=90=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=88=98=E4=BB=A4=E6=9C=AA=E5=88=B7=E6=96=B0=E9=92=BB?= =?UTF-8?q?=E7=9F=B3=E4=BD=99=E9=A2=9D=E3=80=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/dialog/LiberalBattlePassPopupWindow.java | 2 ++ .../java/com/shayu/lib_google/utils/GoogleBillingManage.java | 4 ---- .../com/yunbao/main/fragment/BattlePassMissionFragment.java | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java index dd57c1503..d01dc42a7 100644 --- a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java @@ -14,6 +14,7 @@ import com.yunbao.common.R; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -75,6 +76,7 @@ public class LiberalBattlePassPopupWindow extends CenterPopupView { if (mPassCallback != null) { mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); } + IMLoginManager.get(getContext()).upDataUserInfo(); } @Override diff --git a/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java b/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java index 492603269..0ba4267aa 100644 --- a/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java +++ b/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java @@ -204,10 +204,6 @@ public class GoogleBillingManage implements PurchasesUpdatedListener { } } - public boolean getGoogleService() { - int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext); - return code == 0; - } int resultCode = -1; String resultToken = ""; diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java index 781b51200..bfa6b0d28 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java @@ -78,7 +78,6 @@ public class BattlePassMissionFragment extends BaseFragment { return; } long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp(); - ToastUtil.showDebug("max = "+maxExp+"|"+userInfoBean.getNextLevelExp()); new XPopup.Builder(getContext()) .enableDrag(false) From 24788d7e2138bc299ef42ad2b47e23eeff0250d9 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Jan 2024 13:59:46 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8E=A7=E5=88=B6=E6=96=87=E5=AD=97=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E8=AF=AD=E9=9F=B3=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bean/RoomMicStatusModel.java | 27 +++ .../dialog/SudGameInputPopupWindow.java | 5 +- .../com/yunbao/common/http/PDLiveApi.java | 8 + .../common/http/live/LiveNetManager.java | 25 +++ .../manager/imrongcloud/GameMicManager.java | 62 +++--- .../yunbao/live/activity/SudGameActivity.java | 203 +++++++++++------- 6 files changed, 225 insertions(+), 105 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java diff --git a/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java b/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java new file mode 100644 index 000000000..6292156a5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java @@ -0,0 +1,27 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RoomMicStatusModel extends BaseModel{ + + @SerializedName("mic_status") + private String micStatus; + @SerializedName("im_status") + private String imStatus; + + public String getMicStatus() { + return micStatus; + } + + public void setMicStatus(String micStatus) { + this.micStatus = micStatus; + } + + public String getImStatus() { + return imStatus; + } + + public void setImStatus(String imStatus) { + this.imStatus = imStatus; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java index 08c1f08d5..44444ea1e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java @@ -48,15 +48,16 @@ public class SudGameInputPopupWindow extends BottomPopupView { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.send), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - dialog.dismiss(); + if (sudGameInputCallBack != null) { - String textMessageStr = textMessage.getText().toString(); + String textMessageStr = textMessage.getText().toString().trim(); if (!TextUtils.isEmpty(textMessageStr)) { if (textMessageStr.length() > 100) { ToastUtil.show(WordUtil.isNewZh() ? "超出字數限制" : "Exceed word limit"); } else { sudGameInputCallBack.sendMessage(textMessageStr); } + dialog.dismiss(); } else { ToastUtil.show(WordUtil.getNewString(R.string.cannot_be_empty)); } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 6d0c57c72..fc1f78a04 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -58,6 +58,7 @@ import com.yunbao.common.bean.RedPacketDetailsBean; import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; @@ -1146,12 +1147,19 @@ public interface PDLiveApi { @GET("/api/public/?service=Sudgameserver.joinMic") Observable>> joinMic(@Query("room_id") String roomId); + @GET("/api/public/?service=Sudgameserver.onMic") Observable>> onMic(@Query("room_id") String roomId); + @GET("/api/public/?service=Sudgameserver.offMic") Observable>> offMic(@Query("room_id") String roomId); + @GET("/api/public/?service=Sudgameserver.leaveMic") Observable>> leaveMic(@Query("room_id") String roomId); + @GET("/api/public/?service=Sudgameserver.getRoomMicData") Observable>> getRoomMicData(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.getRoomMicStatus") + Observable> getRoomMicStatus(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 2a27a2328..040407c0d 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -56,6 +56,7 @@ import com.yunbao.common.bean.RedPacketDetailsBean; import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameUserModel; @@ -2908,6 +2909,30 @@ public class LiveNetManager { }).isDisposed(); } + public void getRoomMicStatus(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getRoomMicStatus() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel roomMicStatusModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java index efd2497e3..09da6f188 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java @@ -245,7 +245,7 @@ public class GameMicManager { try { - getView().onSubscribeSuccess(userID,mute,position); + getView().onSubscribeSuccess(userID, mute, position); } catch (IllegalStateException e) { e.printStackTrace(); } @@ -355,35 +355,39 @@ public class GameMicManager { RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM); } - public void joinRoom(String roomId) { + public void joinRoom(String roomId, boolean imOff) { mRoomID = roomId; - RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create() - // 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO - .setRoomType(RCRTCRoomType.MEETING) + if (imOff) { - .build(); - RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback() { - @Override - public void onSuccess(final RCRTCRoom rcrtcRoom) { - GameMicManager.this.mRtcRoom = rcrtcRoom; - // 注册房间回调 - rcrtcRoom.registerRoomListener(roomEventsListener); - try { - getView().onJoinRoomSuccess(rcrtcRoom); - } catch (IllegalStateException e) { - e.printStackTrace(); - } - } + RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create() + // 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO + .setRoomType(RCRTCRoomType.MEETING) - @Override - public void onFailed(RTCErrorCode rtcErrorCode) { - try { - getView().onJoinRoomFailed(rtcErrorCode); - } catch (IllegalStateException e) { - e.printStackTrace(); + .build(); + RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback() { + @Override + public void onSuccess(final RCRTCRoom rcrtcRoom) { + GameMicManager.this.mRtcRoom = rcrtcRoom; + // 注册房间回调 + rcrtcRoom.registerRoomListener(roomEventsListener); + try { + getView().onJoinRoomSuccess(rcrtcRoom); + } catch (IllegalStateException e) { + e.printStackTrace(); + } } - } - }); + + @Override + public void onFailed(RTCErrorCode rtcErrorCode) { + try { + getView().onJoinRoomFailed(rtcErrorCode); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + RongChatRoomClient.getInstance().joinChatRoom("v" + roomId, -1, new IRongCoreCallback.OperationCallback() { @Override public void onSuccess() { @@ -490,7 +494,7 @@ public class GameMicManager { @Override public void onError(Message message, RongIMClient.ErrorCode errorCode) { - + Log.i("tx", "发送成功"+errorCode.toString()); } }); } @@ -515,9 +519,11 @@ public class GameMicManager { void onSubscribeSuccess(List inputStreamList); void onSubscribeFailed(); - void onSubscribeSuccess(String userID,boolean mute, int position); + + void onSubscribeSuccess(String userID, boolean mute, int position); void onSubscribeFailed(String userID); + void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser); void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser); diff --git a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java index 9c9f5d7ea..f2f54e726 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java @@ -27,6 +27,7 @@ import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SudGameChatImModel; import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.dialog.SudGameInputPopupWindow; @@ -83,6 +84,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti private SudGameUserListAdapter sudGameUserListAdapter; private ProcessResultUtil mProcessResultUtil; private List muteUser = new ArrayList<>(); + private boolean imOff; @Override protected int getLayoutId() { @@ -118,10 +120,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti } }); - gameMicManager = new GameMicManager(); - gameMicManager.attachView(this); - gameMicManager.config(this); - gameMicManager.joinRoom(mLiveUid); + // 设置禁用麦克风采集 RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); @@ -142,27 +141,75 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti } }, 1500); mProcessResultUtil = new ProcessResultUtil(this); + LiveNetManager.get(mContext) + .getRoomMicStatus(new HttpCallback() { + @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 { + imOff = false; + gameCloseWheat.setVisibility(View.GONE); + gameSeat.setVisibility(View.GONE); + userList.setVisibility(View.GONE); + } + if (TextUtils.equals(data.getImStatus(), "1")) { + findViewById(R.id.game_review_input).setVisibility(View.VISIBLE); + chatList.setVisibility(View.VISIBLE); + } else { + findViewById(R.id.game_review_input).setVisibility(View.GONE); + chatList.setVisibility(View.GONE); + } + gameMicManager.joinRoom(mLiveUid, imOff); + } + + @Override + public void onError(String error) { + imOff = false; + //文字 + findViewById(R.id.game_review_input).setVisibility(View.GONE); + chatList.setVisibility(View.GONE); + //语音 + gameCloseWheat.setVisibility(View.GONE); + gameSeat.setVisibility(View.GONE); + userList.setVisibility(View.GONE); + } + }); } @Override protected void onDestroy() { - LiveNetManager.get(mContext) - .leaveMic(mLiveUid, new HttpCallback() { - @Override - public void onSuccess(HttpCallbackModel data) { + if (gameMicManager != null) { + gameMicManager.leaveRoom(); + gameMicManager.detachView(); + } + if (!imOff) { + LiveNetManager.get(mContext) + .leaveMic(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { - } + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { + + } + }); + } - } - }); Bus.getOff(this); - gameMicManager.leaveRoom(); - gameMicManager.detachView(); + super.onDestroy(); } @@ -256,28 +303,30 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_seat), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { - if (publishDefault) { - disable = true; - // 设置禁用麦克风采集 - RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); - ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); - gameMicManager.unPublishStreams(); - } else { - if (sudGameUserListAdapter.isMicMax()) { - ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7"); + if (!imOff && gameMicManager != null) { + if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { + if (publishDefault) { + disable = true; + // 设置禁用麦克风采集 + RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); + ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); + gameMicManager.unPublishStreams(); } else { - gameMicManager.publishDefaultAVStream(); - } + if (sudGameUserListAdapter.isMicMax()) { + ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7"); + } else { + gameMicManager.publishDefaultAVStream(); + } + } + } else { + mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() { + @Override + public void run() { + + } + }); } - } else { - mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() { - @Override - public void run() { - - } - }); } @@ -286,54 +335,57 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { - if (disable) { - disable = false; - // 设置禁用麦克风采集 - RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); - ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat); - LiveNetManager.get(mContext) - .onMic(mLiveUid, new HttpCallback() { - @Override - public void onSuccess(HttpCallbackModel data) { + if (!imOff && gameMicManager != null) { + if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { + if (disable) { + disable = false; + // 设置禁用麦克风采集 + RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); + ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat); + LiveNetManager.get(mContext) + .onMic(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { - } + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); - ToastUtil.show(WordUtil.isNewZh() ? "麥克風已開啟" : "Microphone turned on"); - } else { - disable = true; - // 设置禁用麦克风采集 - RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); - ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); - LiveNetManager.get(mContext) - .offMic(mLiveUid, new HttpCallback() { - @Override - public void onSuccess(HttpCallbackModel data) { + } + }); + ToastUtil.show(WordUtil.isNewZh() ? "麥克風已開啟" : "Microphone turned on"); + } else { + disable = true; + // 设置禁用麦克风采集 + RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); + ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); + LiveNetManager.get(mContext) + .offMic(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { - } + } - @Override - public void onError(String error) { - - } - }); - ToastUtil.show(WordUtil.isNewZh() ? "麥克風已關閉" : "Microphone turned off"); - } - - } else { - mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() { - @Override - public void run() { + @Override + public void onError(String error) { + } + }); + ToastUtil.show(WordUtil.isNewZh() ? "麥克風已關閉" : "Microphone turned off"); } - }); + + } else { + mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() { + @Override + public void run() { + + } + }); + } } + } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_review_input), new ViewClicksAntiShake.ViewClicksCallBack() { @@ -406,7 +458,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { @Override public void onSuccess(CheckRemainingBalance data) { - if (TextUtils.equals(String.valueOf(data.getGoldenBeanRemainingBalance() ),"1")) { + if (TextUtils.equals(String.valueOf(data.getGoldenBeanRemainingBalance()), "1")) { gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); } else { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { @@ -466,6 +518,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback>() { @Override public void onSuccess(List data) { + gameMicManager.refreshStreams(data); sudGameUserListAdapter.refreshSudGameUserList(data, muteUser); } @@ -481,7 +534,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti @Override public void onJoinRoomFailed(RTCErrorCode rtcErrorCode) { - ToastUtil.show("加入失败 "+rtcErrorCode.toString()); + ToastUtil.show("加入失败 " + rtcErrorCode.toString()); } @Override From 58b2d69601d03d397cf924428c440331edb4e5a5 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Jan 2024 14:31:59 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8E=A7=E5=88=B6=E6=96=87=E5=AD=97=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E8=AF=AD=E9=9F=B3=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/yunbao/live/activity/SudGameActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java index f2f54e726..f190a21a1 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java @@ -193,7 +193,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti gameMicManager.leaveRoom(); gameMicManager.detachView(); } - if (!imOff) { + if (imOff) { LiveNetManager.get(mContext) .leaveMic(mLiveUid, new HttpCallback() { @Override @@ -303,7 +303,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_seat), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - if (!imOff && gameMicManager != null) { + if (imOff && gameMicManager != null) { if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { if (publishDefault) { disable = true; @@ -335,7 +335,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - if (!imOff && gameMicManager != null) { + if (imOff && gameMicManager != null) { if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { if (disable) { disable = false; From 2aa50ecfc7477fb89026899003a777bc42956900 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Jan 2024 16:15:00 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8E=A7=E5=88=B6=E6=96=87=E5=AD=97=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E8=AF=AD=E9=9F=B3=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog/SudGameSmallPopupPindow.java | 2 +- .../yunbao/live/activity/SudGameActivity.java | 59 +++++++++---------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java b/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java index 5c2d527d8..e7bec0482 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java @@ -48,7 +48,7 @@ public class SudGameSmallPopupPindow extends AttachPopupView { return; } if (sudGameUserModel.getMicStatus() == 3) { - ToastUtil.show("对方未开麦!"); + ToastUtil.show(WordUtil.isNewZh() ? "對方未開麥!" : "The other side did not turn on the microphone"); return; } if (!mute) { diff --git a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java index f190a21a1..c9093b892 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java @@ -126,20 +126,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); 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); LiveNetManager.get(mContext) .getRoomMicStatus(new HttpCallback() { @@ -151,13 +138,24 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti //语音 if (TextUtils.equals(data.getMicStatus(), "1")) { imOff = true; - - gameCloseWheat.setVisibility(View.VISIBLE); gameSeat.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 { imOff = false; - gameCloseWheat.setVisibility(View.GONE); gameSeat.setVisibility(View.GONE); userList.setVisibility(View.GONE); } @@ -189,25 +187,24 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti @Override protected void onDestroy() { + + LiveNetManager.get(mContext) + .leaveMic(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + + } + + @Override + public void onError(String error) { + + } + }); + if (gameMicManager != null) { gameMicManager.leaveRoom(); gameMicManager.detachView(); } - if (imOff) { - LiveNetManager.get(mContext) - .leaveMic(mLiveUid, new HttpCallback() { - @Override - public void onSuccess(HttpCallbackModel data) { - - } - - @Override - public void onError(String error) { - - } - }); - } - Bus.getOff(this); super.onDestroy(); From 29c2334ee0bda01225fcca2a42945739c82ce42f Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Jan 2024 16:22:29 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8E=A7=E5=88=B6=E6=96=87=E5=AD=97=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E8=AF=AD=E9=9F=B3=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/yunbao/common/views/LiveSudGamePopup.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java index 1b69c3fe6..01776f158 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -98,8 +98,10 @@ public class LiveSudGamePopup extends BottomPopupView { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { + gameViewModel.onDestroy(); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2)); + dismiss(); } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() { From 1f7c6c8adc9207cf913145bd107dfd755d843f5f Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Jan 2024 17:04:36 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8E=A7=E5=88=B6=E6=96=87=E5=AD=97=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E8=AF=AD=E9=9F=B3=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/yunbao/live/activity/SudGameActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java index c9093b892..1a24684c3 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java @@ -306,7 +306,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti disable = true; // 设置禁用麦克风采集 RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); - ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); +// ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat); gameMicManager.unPublishStreams(); } else { if (sudGameUserListAdapter.isMicMax()) {