Merge remote-tracking branch 'origin/master'

This commit is contained in:
hch 2024-01-15 17:11:40 +08:00
commit b5c8f14994
11 changed files with 231 additions and 115 deletions

View File

@ -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;
}
}

View File

@ -14,6 +14,7 @@ import com.yunbao.common.R;
import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -75,6 +76,7 @@ public class LiberalBattlePassPopupWindow extends CenterPopupView {
if (mPassCallback != null) { if (mPassCallback != null) {
mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg());
} }
IMLoginManager.get(getContext()).upDataUserInfo();
} }
@Override @Override

View File

@ -48,15 +48,16 @@ public class SudGameInputPopupWindow extends BottomPopupView {
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.send), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.send), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
dialog.dismiss();
if (sudGameInputCallBack != null) { if (sudGameInputCallBack != null) {
String textMessageStr = textMessage.getText().toString(); String textMessageStr = textMessage.getText().toString().trim();
if (!TextUtils.isEmpty(textMessageStr)) { if (!TextUtils.isEmpty(textMessageStr)) {
if (textMessageStr.length() > 100) { if (textMessageStr.length() > 100) {
ToastUtil.show(WordUtil.isNewZh() ? "超出字數限制" : "Exceed word limit"); ToastUtil.show(WordUtil.isNewZh() ? "超出字數限制" : "Exceed word limit");
} else { } else {
sudGameInputCallBack.sendMessage(textMessageStr); sudGameInputCallBack.sendMessage(textMessageStr);
} }
dialog.dismiss();
} else { } else {
ToastUtil.show(WordUtil.getNewString(R.string.cannot_be_empty)); ToastUtil.show(WordUtil.getNewString(R.string.cannot_be_empty));
} }

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

@ -58,6 +58,7 @@ import com.yunbao.common.bean.RedPacketDetailsBean;
import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.RoomMicStatusModel;
import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.SlideInBannerModel;
@ -1146,12 +1147,19 @@ public interface PDLiveApi {
@GET("/api/public/?service=Sudgameserver.joinMic") @GET("/api/public/?service=Sudgameserver.joinMic")
Observable<ResponseModel<List<BaseModel>>> joinMic(@Query("room_id") String roomId); Observable<ResponseModel<List<BaseModel>>> joinMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.onMic") @GET("/api/public/?service=Sudgameserver.onMic")
Observable<ResponseModel<List<BaseModel>>> onMic(@Query("room_id") String roomId); Observable<ResponseModel<List<BaseModel>>> onMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.offMic") @GET("/api/public/?service=Sudgameserver.offMic")
Observable<ResponseModel<List<BaseModel>>> offMic(@Query("room_id") String roomId); Observable<ResponseModel<List<BaseModel>>> offMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.leaveMic") @GET("/api/public/?service=Sudgameserver.leaveMic")
Observable<ResponseModel<List<BaseModel>>> leaveMic(@Query("room_id") String roomId); Observable<ResponseModel<List<BaseModel>>> leaveMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.getRoomMicData") @GET("/api/public/?service=Sudgameserver.getRoomMicData")
Observable<ResponseModel<List<SudGameUserModel>>> getRoomMicData(@Query("room_id") String roomId); Observable<ResponseModel<List<SudGameUserModel>>> getRoomMicData(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.getRoomMicStatus")
Observable<ResponseModel<RoomMicStatusModel>> getRoomMicStatus();
} }

View File

@ -56,6 +56,7 @@ import com.yunbao.common.bean.RedPacketDetailsBean;
import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketGiftModel;
import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.RoomMicStatusModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudGameUserModel;
@ -2908,6 +2909,30 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void getRoomMicStatus(HttpCallback<RoomMicStatusModel> callback) {
API.get().pdLiveApi(mContext)
.getRoomMicStatus()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<RoomMicStatusModel>>() {
@Override
public void accept(ResponseModel<RoomMicStatusModel> roomMicStatusModelResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求
*/ */

View File

@ -355,8 +355,10 @@ public class GameMicManager {
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM); 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; mRoomID = roomId;
if (imOff) {
RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create() RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
// 根据实际场景选择音视频直播LIVE_AUDIO_VIDEO 或音频直播LIVE_AUDIO // 根据实际场景选择音视频直播LIVE_AUDIO_VIDEO 或音频直播LIVE_AUDIO
.setRoomType(RCRTCRoomType.MEETING) .setRoomType(RCRTCRoomType.MEETING)
@ -384,6 +386,8 @@ public class GameMicManager {
} }
} }
}); });
}
RongChatRoomClient.getInstance().joinChatRoom("v" + roomId, -1, new IRongCoreCallback.OperationCallback() { RongChatRoomClient.getInstance().joinChatRoom("v" + roomId, -1, new IRongCoreCallback.OperationCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
@ -490,7 +494,7 @@ public class GameMicManager {
@Override @Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) { public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.i("tx", "发送成功"+errorCode.toString());
} }
}); });
} }
@ -515,9 +519,11 @@ public class GameMicManager {
void onSubscribeSuccess(List<RCRTCInputStream> inputStreamList); void onSubscribeSuccess(List<RCRTCInputStream> inputStreamList);
void onSubscribeFailed(); void onSubscribeFailed();
void onSubscribeSuccess(String userID, boolean mute, int position); void onSubscribeSuccess(String userID, boolean mute, int position);
void onSubscribeFailed(String userID); void onSubscribeFailed(String userID);
void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser); void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser);
void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser); void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser);

View File

@ -98,8 +98,10 @@ public class LiveSudGamePopup extends BottomPopupView {
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
gameViewModel.onDestroy(); gameViewModel.onDestroy();
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2)); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2));
dismiss();
} }
}); });
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() {

View File

@ -204,10 +204,6 @@ public class GoogleBillingManage implements PurchasesUpdatedListener {
} }
} }
public boolean getGoogleService() {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext);
return code == 0;
}
int resultCode = -1; int resultCode = -1;
String resultToken = ""; String resultToken = "";

View File

@ -27,6 +27,7 @@ import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.RoomMicStatusModel;
import com.yunbao.common.bean.SudGameChatImModel; import com.yunbao.common.bean.SudGameChatImModel;
import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.dialog.SudGameInputPopupWindow; import com.yunbao.common.dialog.SudGameInputPopupWindow;
@ -83,6 +84,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
private SudGameUserListAdapter sudGameUserListAdapter; private SudGameUserListAdapter sudGameUserListAdapter;
private ProcessResultUtil mProcessResultUtil; private ProcessResultUtil mProcessResultUtil;
private List<String> muteUser = new ArrayList<>(); private List<String> muteUser = new ArrayList<>();
private boolean imOff;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
@ -118,15 +120,26 @@ 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); 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);
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() {
@ -141,13 +154,40 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
} }
}, 1500); }, 1500);
mProcessResultUtil = new ProcessResultUtil(this); } else {
imOff = false;
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 @Override
protected void onDestroy() { protected void onDestroy() {
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() { .leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override @Override
@ -160,9 +200,13 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
}); });
Bus.getOff(this);
if (gameMicManager != null) {
gameMicManager.leaveRoom(); gameMicManager.leaveRoom();
gameMicManager.detachView(); gameMicManager.detachView();
}
Bus.getOff(this);
super.onDestroy(); super.onDestroy();
} }
@ -256,12 +300,13 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_seat), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_seat), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if (imOff && gameMicManager != null) {
if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
if (publishDefault) { if (publishDefault) {
disable = true; disable = true;
// 设置禁用麦克风采集 // 设置禁用麦克风采集
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); 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(); gameMicManager.unPublishStreams();
} else { } else {
if (sudGameUserListAdapter.isMicMax()) { if (sudGameUserListAdapter.isMicMax()) {
@ -279,6 +324,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
}); });
} }
}
} }
@ -286,6 +332,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if (imOff && gameMicManager != null) {
if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) { if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
if (disable) { if (disable) {
disable = false; disable = false;
@ -333,6 +380,8 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
}); });
} }
}
} }
}); });
@ -466,6 +515,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() { LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
@Override @Override
public void onSuccess(List<SudGameUserModel> data) { public void onSuccess(List<SudGameUserModel> data) {
gameMicManager.refreshStreams(data); gameMicManager.refreshStreams(data);
sudGameUserListAdapter.refreshSudGameUserList(data, muteUser); sudGameUserListAdapter.refreshSudGameUserList(data, muteUser);
} }

View File

@ -78,7 +78,6 @@ public class BattlePassMissionFragment extends BaseFragment {
return; return;
} }
long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp(); long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp();
ToastUtil.showDebug("max = "+maxExp+"|"+userInfoBean.getNextLevelExp());
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.enableDrag(false) .enableDrag(false)