语音房接口添加

This commit is contained in:
18401019693 2024-01-11 15:15:21 +08:00
parent 926a1a3cb6
commit a036e5eff6
23 changed files with 880 additions and 48 deletions

View File

@ -56,9 +56,7 @@
<activity
android:name="com.yunbao.common.activity.SelectImageActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yunbao.common.activity.SudGameActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yunbao.common.activity.PreviewImageActivity"

View File

@ -1,5 +1,6 @@
package com.yunbao.common.adapter;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -9,7 +10,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.views.SudGameChatViewHolder;
import com.yunbao.common.views.SudGameUserListViewHolder;
import java.util.ArrayList;
@ -17,6 +17,7 @@ import java.util.List;
public class SudGameUserListAdapter extends RecyclerView.Adapter {
private List<SudGameUserModel> gameUserModels = new ArrayList<>();
private boolean micMax = false;
public SudGameUserListAdapter(List<SudGameUserModel> gameUserModels) {
@ -42,6 +43,34 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
}
public void refreshSudGameUserList(List<SudGameUserModel> gameUserModels) {
this.gameUserModels.clear();
if (gameUserModels.size() < 7) {
micMax = false;
this.gameUserModels.addAll(gameUserModels);
for (int i = 0; i < this.gameUserModels.size(); i++) {
this.gameUserModels.get(i).setNullUser(false);
}
int size = 7 - gameUserModels.size();
for (int i = 0; i < size; i++) {
this.gameUserModels.add(new SudGameUserModel().setNullUser(true));
}
} else if (gameUserModels.size() == 7) {
micMax = true;
this.gameUserModels.addAll(gameUserModels);
for (int i = 0; i < this.gameUserModels.size(); i++) {
this.gameUserModels.get(i).setNullUser(false);
}
} else {
micMax = true;
for (int i = 0; i < 7; i++) {
this.gameUserModels.add(gameUserModels.get(i).setNullUser(false));
}
}
notifyDataSetChanged();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -51,11 +80,44 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
SudGameUserListViewHolder sudGameUserListViewHolder = (SudGameUserListViewHolder) holder;
sudGameUserListViewHolder.upData(gameUserModels.get(position), sudGameSmallCallBack,position);
}
@Override
public int getItemCount() {
return gameUserModels.size();
}
public boolean isMicMax() {
return micMax;
}
public void muteUser(String userID, boolean mute, int position) {
for (int i = 0; i < gameUserModels.size(); i++) {
SudGameUserModel sudGameUserModel = gameUserModels.get(i);
if (!sudGameUserModel.isNullUser()) {
if (TextUtils.equals(userID, String.valueOf(sudGameUserModel.getId()))) {
gameUserModels.get(i).setMicStatus(mute ? 1 : 3);
}
}
}
notifyItemChanged(position);
}
private SudGameSmallCallBack sudGameSmallCallBack;
public SudGameUserListAdapter setSudGameSmallCallBack(SudGameSmallCallBack sudGameSmallCallBack) {
this.sudGameSmallCallBack = sudGameSmallCallBack;
return this;
}
public interface SudGameSmallCallBack {
void unMute(String userID, int position);
void mute(String userID, int position);
void viewInformation(SudGameUserModel sudGameUserModel);
}
}

View File

@ -1,7 +1,19 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class SudGameUserModel extends BaseModel {
private boolean nullUser;
@SerializedName("user_nicename")
private String userNicename;
@SerializedName("avatar")
private String avatar;
@SerializedName("sex")
private int sex;
@SerializedName("id")
private int id;
@SerializedName("mic_status")
private int micStatus; //麦克风状态 2.打开麦克风 3.关闭麦克风
public boolean isNullUser() {
return nullUser;
@ -11,4 +23,49 @@ public class SudGameUserModel extends BaseModel {
this.nullUser = nullUser;
return this;
}
public String getUserNicename() {
return userNicename;
}
public SudGameUserModel setUserNicename(String userNicename) {
this.userNicename = userNicename;
return this;
}
public String getAvatar() {
return avatar;
}
public SudGameUserModel setAvatar(String avatar) {
this.avatar = avatar;
return this;
}
public int getSex() {
return sex;
}
public SudGameUserModel setSex(int sex) {
this.sex = sex;
return this;
}
public int getId() {
return id;
}
public SudGameUserModel setId(int id) {
this.id = id;
return this;
}
public int getMicStatus() {
return micStatus;
}
public SudGameUserModel setMicStatus(int micStatus) {
this.micStatus = micStatus;
return this;
}
}

View File

@ -21,7 +21,6 @@ import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.enums.PopupPosition;
import com.yunbao.common.R;
import com.yunbao.common.activity.SudGameActivity;
import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CheckCurrencyModel;
@ -33,6 +32,7 @@ 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.Bus;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -279,9 +279,7 @@ public class CreateSudGamePopup extends BottomPopupView {
public void onSuccess(CreateSudRoomModel data) {
if (isHome) {
dialog.dismiss();
Intent intent = new Intent(getContext(), SudGameActivity.class);
intent.putExtra("CreateSudRoom", new Gson().toJson(data));
getContext().startActivity(intent);
RouteUtil.forwardSudGameActivity(new Gson().toJson(data));
} else {
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));

View File

@ -0,0 +1,73 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.core.AttachPopupView;
import com.yunbao.common.R;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class SudGameSmallPopupPindow extends AttachPopupView {
private TextView viewUnMute;
private boolean mute;
private SudGameUserModel sudGameUserModel;
private SudGameSmallCallBack sudGameSmallCallBack;
public SudGameSmallPopupPindow(@NonNull Context context, SudGameUserModel sudGameUserModel, boolean mute, SudGameSmallCallBack sudGameSmallCallBack) {
super(context);
this.mute = mute;
this.sudGameUserModel = sudGameUserModel;
this.sudGameSmallCallBack = sudGameSmallCallBack;
}
@Override
protected int getImplLayoutId() {
return R.layout.view_sud_game_small;
}
@Override
protected void onCreate() {
viewUnMute = findViewById(R.id.view_un_mute);
if (mute) {
viewUnMute.setText(WordUtil.isNewZh() ? "取消靜音" : "Unmute");
} else {
viewUnMute.setText(WordUtil.isNewZh() ? "靜音" : "Mute");
}
ViewClicksAntiShake.clicksAntiShake(viewUnMute, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (sudGameUserModel.getMicStatus() == 3) {
ToastUtil.show("对方未开麦!");
return;
}
if (!mute) {
sudGameSmallCallBack.mute();
} else {
sudGameSmallCallBack.unMute();
}
dismiss();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.view_information), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
sudGameSmallCallBack.viewInformation(sudGameUserModel);
dismiss();
}
});
}
public interface SudGameSmallCallBack {
void unMute();
void mute();
void viewInformation(SudGameUserModel sudGameUserModel);
}
}

View File

@ -0,0 +1,17 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.SudGameUserModel;
public class SudGameUserEvent extends BaseModel {
private SudGameUserModel sudGameUserModel;
public SudGameUserModel getSudGameUserModel() {
return sudGameUserModel;
}
public SudGameUserEvent setSudGameUserModel(SudGameUserModel sudGameUserModel) {
this.sudGameUserModel = sudGameUserModel;
return this;
}
}

View File

@ -62,6 +62,7 @@ import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean;
@ -1115,24 +1116,42 @@ public interface PDLiveApi {
@Query("battle_pass_points_id") String battlePassPointsId,
@Query("count") String count
);
@GET("/api/public/?service=Livebattlepass.getBattlePassUserInfo")
Observable<ResponseModel<BattlePassUserInfoBean>> getBattlePassUserInfo();
@GET("/api/public/?service=Livebattlepass.getLiveBattlePassRewards")
Observable<ResponseModel<LiveBattlePassRewardsBean>> getLiveBattlePassRewards();
@GET("/api/public/?service=Livebattlepass.getRewards")
Observable<ResponseModel<List<BaseModel>>> getRewards(
@Query("live_battle_pass_level_id") String rewardLevelId,
@Query("live_battle_pass_rewards_id") String rewardId
);
@GET("/api/public/?service=Livebattlepass.getBattlePassTask")
Observable<ResponseModel<BattlePassTask>> getBattlePassTask();
@GET("/api/public/?service=Livebattlepass.getTask")
Observable<ResponseModel<List<BaseModel>>> getTask(@Query("task_id") String taskId);
@GET("/api/public/?service=Livebattlepass.getBattlePassPoints")
Observable<ResponseModel<List<BattlePassPoints>>> getBattlePassPoints();
@GET("/api/public/?service=Livebattlepass.battlePassRule")
Observable<ResponseModel<String>> battlePassRule();
@GET("/api/public/?service=Livebattlepass.addChatCount")
Observable<ResponseModel<List<BaseModel>>> addChatCount();
@GET("/api/public/?service=Sudgameserver.joinMic")
Observable<ResponseModel<List<BaseModel>>> joinMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.onMic")
Observable<ResponseModel<List<BaseModel>>> onMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.offMic")
Observable<ResponseModel<List<BaseModel>>> offMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.leaveMic")
Observable<ResponseModel<List<BaseModel>>> leaveMic(@Query("room_id") String roomId);
@GET("/api/public/?service=Sudgameserver.getRoomMicData")
Observable<ResponseModel<List<SudGameUserModel>>> getRoomMicData(@Query("room_id") String roomId);
}

View File

@ -58,6 +58,7 @@ import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean;
@ -2769,6 +2770,7 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void addChatCount(HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.addChatCount()
@ -2790,6 +2792,122 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void joinMic(String roomId, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.joinMic(roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
@Override
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
}
}
}, 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();
}
public void onMic(String roomId, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.onMic(roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
@Override
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
}
}
}, 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();
}
public void offMic(String roomId, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.offMic(roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
@Override
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
}
}
}, 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();
}
public void leaveMic(String roomId, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.leaveMic(roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
@Override
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
}
}
}, 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();
}
public void getRoomMicData(String roomId, HttpCallback<List<SudGameUserModel>> callback) {
API.get().pdLiveApi(mContext)
.getRoomMicData(roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<SudGameUserModel>>>() {
@Override
public void accept(ResponseModel<List<SudGameUserModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.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

@ -5,9 +5,11 @@ import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.SudGameChatImModel;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.ToastUtil;
@ -24,6 +26,7 @@ import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RTCErrorCode;
import io.rong.imlib.IRongCallback;
@ -50,7 +53,7 @@ public class GameMicManager {
*/
@Override
public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, final List<RCRTCInputStream> list) {
subscribeAVStream();
// subscribeAVStream();
}
@Override
@ -147,6 +150,7 @@ public class GameMicManager {
}
inputStreams.addAll(remoteUser.getStreams());
}
if (inputStreams.size() == 0) {
@ -175,6 +179,88 @@ public class GameMicManager {
});
}
public void refreshStreams(List<SudGameUserModel> personList) {
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
for (SudGameUserModel sudGameUserModel : personList) {
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) {
if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(sudGameUserModel.getId()))) {
for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) {
rcrtcInputStream.mute(sudGameUserModel.getMicStatus() == 3);
}
inputStreams.addAll(rcrtcRemoteUser.getStreams());
}
}
}
if (inputStreams.size() == 0) {
return;
}
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
try {
getView().onSubscribeSuccess(inputStreams);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
@Override
public void onFailed(RTCErrorCode errorCode) {
try {
getView().onSubscribeFailed();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
});
}
public void refreshStreams(String userID, boolean mute, int position) {
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) {
if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(userID))) {
for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) {
rcrtcInputStream.mute(mute);
}
inputStreams.addAll(rcrtcRemoteUser.getStreams());
}
}
if (inputStreams.size() == 0) {
return;
}
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
try {
getView().onSubscribeSuccess(userID,mute,position);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
@Override
public void onFailed(RTCErrorCode errorCode) {
try {
getView().onSubscribeFailed(userID);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
});
}
public void unPublishStreams() {
if (mRtcRoom == null) {
return;
@ -263,8 +349,9 @@ public class GameMicManager {
//打开扬声器
RCRTCEngine.getInstance().enableSpeaker(true);
// 启用耳返功能
// RCRTCEngine.getInstance().getDefaultAudioStream().enableEarMonitoring(true);
RCRTCEngine.getInstance().getDefaultAudioStream().enableEarMonitoring(true);
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(false);
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM);
}
public void joinRoom(String roomId) {
@ -272,6 +359,7 @@ public class GameMicManager {
RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
// 根据实际场景选择音视频直播LIVE_AUDIO_VIDEO 或音频直播LIVE_AUDIO
.setRoomType(RCRTCRoomType.MEETING)
.build();
RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback<RCRTCRoom>() {
@Override
@ -348,6 +436,13 @@ public class GameMicManager {
//正常文字消息
if (TextUtils.equals(msgDTO.getMethod(), "SendMsg")) {
getView().insertItem(new SudGameChatImModel().setNickname(msgDTO.getUname()).setTextMessage(msgDTO.getCt()));
} else if (TextUtils.equals(msgDTO.getMethod(), "sudGameRoomVoiceList")) {
List<SudGameUserModel> personList = new Gson().fromJson(msgDTO.getCt(), new TypeToken<List<SudGameUserModel>>() {
}.getType());
getView().refreshSudGameUserList(personList);
refreshStreams(personList);
}
}
@ -419,11 +514,15 @@ public class GameMicManager {
void onSubscribeSuccess(List<RCRTCInputStream> inputStreamList);
void onSubscribeFailed();
void onSubscribeSuccess(String userID,boolean mute, int position);
void onSubscribeFailed(String userID);
void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser);
void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser);
void insertItem(SudGameChatImModel sudGameChatImModel);
void refreshSudGameUserList(List<SudGameUserModel> personList);
}
}

View File

@ -46,12 +46,18 @@ public class RouteUtil {
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
public static final String PATH_SudGameActivity="/live/SudGameActivity";
public static void forwardFansActivity(String uid) {
ARouter.getInstance().build(PATH_FANSACTIVITY)
.withString(Constants.TO_UID, uid)
.navigation();
}
public static void forwardSudGameActivity(String CreateSudRoom) {
ARouter.getInstance().build(PATH_SudGameActivity)
.withString("CreateSudRoom", CreateSudRoom)
.navigation();
}
public static void forwardMyWebViewActivity2(String url) {
ARouter.getInstance().build(PATH_MYWEBVIEWACTIVTITY2)

View File

@ -15,7 +15,6 @@ import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.activity.SudGameActivity;
import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.SudRoomListModel;
@ -107,9 +106,8 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
createSudRoomModel.setSudGameName(model.getSudGameName());
if (isHome) {
if (TextUtils.equals(model.getLiveUid(), "0")) {
Intent intent = new Intent(itemView.getContext(), SudGameActivity.class);
intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel));
itemView.getContext().startActivity(intent);
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
} else {
String yes = "";
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
@ -158,9 +156,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
@Override
public void onCancel() {
Intent intent = new Intent(itemView.getContext(), SudGameActivity.class);
intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel));
itemView.getContext().startActivity(intent);
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
}
})).show();

View File

@ -1,12 +1,86 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.SudGameUserListAdapter;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.dialog.SudGameSmallPopupPindow;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class SudGameUserListViewHolder extends RecyclerView.ViewHolder {
private ImageView vacancy_sud_game, mic_status;
private FrameLayout user_layout;
private RoundedImageView sud_game_user;
public SudGameUserListViewHolder(@NonNull View itemView) {
super(itemView);
vacancy_sud_game = itemView.findViewById(R.id.vacancy_sud_game);
sud_game_user = itemView.findViewById(R.id.sud_game_user);
user_layout = itemView.findViewById(R.id.user_layout);
mic_status = itemView.findViewById(R.id.mic_status);
}
public void upData(SudGameUserModel sudGameUserModel, SudGameUserListAdapter.SudGameSmallCallBack sudGameSmallCallBack, int position) {
if (sudGameUserModel.isNullUser()) {
vacancy_sud_game.setVisibility(View.VISIBLE);
user_layout.setVisibility(View.GONE);
ViewClicksAntiShake.clicksAntiShake(vacancy_sud_game, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Bus.get().post(sudGameUserModel);
}
});
} else {
vacancy_sud_game.setVisibility(View.GONE);
user_layout.setVisibility(View.VISIBLE);
ImgLoader.display2(itemView.getContext(), sudGameUserModel.getAvatar(), sud_game_user);
if (sudGameUserModel.getMicStatus() == 2) {
ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_open_wheat, mic_status);
} else if (sudGameUserModel.getMicStatus() == 3) {
ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_close_wheat, mic_status);
} else if (sudGameUserModel.getMicStatus() == 1) {
ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_close_wheat_mute, mic_status);
}
ViewClicksAntiShake.clicksAntiShake(user_layout, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
XPopup.Builder builder = new XPopup.Builder(itemView.getContext()).atView(user_layout);
builder.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Bottom)
.asCustom(new SudGameSmallPopupPindow(itemView.getContext(),
sudGameUserModel,
sudGameUserModel.getMicStatus() == 1,
new SudGameSmallPopupPindow.SudGameSmallCallBack() {
@Override
public void unMute() {
sudGameSmallCallBack.unMute(sudGameUserModel.getId() + "",position);
}
@Override
public void mute() {
sudGameSmallCallBack.mute(sudGameUserModel.getId() + "",position);
}
@Override
public void viewInformation(SudGameUserModel sudGameUserModel) {
sudGameSmallCallBack.viewInformation(sudGameUserModel);
}
})).show();
}
});
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_selected="false">
<shape>
<solid android:color="#0000" />
</shape>
</item>
<item android:state_selected="true">
<shape>
<solid android:color="#252525" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="70dp"
android:layout_height="110dp"
android:background="@mipmap/backgroud_sud_game_small_window"
android:orientation="vertical">
<TextView
android:id="@+id/view_information"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_live_sud_list_select_item2"
android:gravity="center"
android:text="@string/game_review_view_information"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/view_un_mute"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="2dp"
android:background="@drawable/bg_live_sud_list_select_item2"
android:gravity="center"
android:text="@string/game_review_view_unmute"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
@ -10,12 +11,32 @@
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginStart="12dp"
android:src="@mipmap/icon_vacancy_sud_game" />
android:src="@mipmap/icon_vacancy_sud_game"
android:visibility="visible" />
<FrameLayout
android:layout_width="50dp"
android:id="@+id/user_layout"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:visibility="gone">
android:visibility="visible">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/sud_game_user"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="12dp"
android:scaleType="centerCrop"
android:src="@mipmap/icon_vacancy_sud_game"
app:riv_oval="true" />
<ImageView
android:id="@+id/mic_status"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:src="@mipmap/icon_game_close_wheat_mute" />
</FrameLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1429,4 +1429,7 @@ Limited ride And limited avatar frame</string>
<string name="battlepass_zl_get">Successfully opened</string>
<string name="battlepass_buy_max">You have purchased the BattlePass</string>
<string name="game_review_input">評論</string>
<string name="game_review_view_information">查看信息</string>
<string name="game_review_view_unmute">取消靜音</string>
<string name="game_review_view_sound_off">靜音</string>
</resources>

View File

@ -84,6 +84,9 @@
<activity
android:name=".activity.WebViewActivityMedal"
android:screenOrientation="portrait" />
<activity
android:name=".activity.SudGameActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.MedalQuestionWebViewActivity"
android:screenOrientation="portrait" />

View File

@ -1,6 +1,10 @@
package com.yunbao.common.activity;
package com.yunbao.live.activity;
import android.Manifest;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -10,19 +14,25 @@ import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.adapter.SudGameChatAdapter;
import com.yunbao.common.adapter.SudGameUserListAdapter;
import com.yunbao.common.bean.CheckRemainingBalance;
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.SudGameChatImModel;
import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.dialog.SudGameInputPopupWindow;
import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.event.SudGameUserEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
@ -34,11 +44,16 @@ import com.yunbao.common.sud.model.GameViewInfoModel;
import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.LiveSudGameHistoryPopup;
import com.yunbao.common.views.TopGradual;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -51,7 +66,7 @@ import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.RCRTCRoom;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.base.RTCErrorCode;
@Route(path = RouteUtil.PATH_SudGameActivity)
public class SudGameActivity extends AbsActivity implements GameMicManager.MeetingCallback {
private FrameLayout gameContainer;
private long mInteractionID;
@ -67,6 +82,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
private RecyclerView chatList, userList;
private SudGameChatAdapter mLiveChatAdapter;
private SudGameUserListAdapter sudGameUserListAdapter;
private ProcessResultUtil mProcessResultUtil;
@Override
protected int getLayoutId() {
@ -84,6 +100,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
private void initDate() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
@ -109,10 +126,51 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
gameCloseWheat.setVisibility(View.INVISIBLE);
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
@Override
public void onSuccess(List<SudGameUserModel> data) {
gameMicManager.refreshStreams(data);
sudGameUserListAdapter.refreshSudGameUserList(data);
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
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);
}
@Override
protected void onDestroy() {
LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
Bus.getOff(this);
gameMicManager.leaveRoom();
gameMicManager.detachView();
@ -120,6 +178,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
}
private void initView() {
String createSudRoomJson = getIntent().getStringExtra("CreateSudRoom");
mCreateSudRoomModel = new Gson().fromJson(createSudRoomJson, CreateSudRoomModel.class);
mInteractionID = mCreateSudRoomModel.getLongSudGameId();
@ -148,6 +207,38 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
mLiveChatAdapter = new SudGameChatAdapter(mContext);
chatList.setAdapter(mLiveChatAdapter);
sudGameUserListAdapter = new SudGameUserListAdapter(new ArrayList<>());
sudGameUserListAdapter.setSudGameSmallCallBack(new SudGameUserListAdapter.SudGameSmallCallBack() {
@Override
public void unMute(String userID, int position) {
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
gameMicManager.refreshStreams(userID, false, position);
} else {
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
}
}
@Override
public void mute(String userID, int position) {
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
gameMicManager.refreshStreams(userID, true, position);
} else {
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
}
}
@Override
public void viewInformation(SudGameUserModel sudGameUserModel) {
LiveUserDialogFragment fragment = new LiveUserDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, "uid");
bundle.putString(Constants.STREAM, "");
bundle.putString(Constants.TO_UID, sudGameUserModel.getId() + "");
fragment.setArguments(bundle);
fragment.show(((SudGameActivity) mContext).getSupportFragmentManager(), "LiveUserDialogFragment");
}
});
userList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
userList.setAdapter(sudGameUserListAdapter);
if (mCreateSudRoomModel != null) {
@ -173,32 +264,82 @@ 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");
} else {
gameMicManager.publishDefaultAVStream();
}
}
} else {
mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
@Override
public void run() {
}
});
}
}
});
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<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
} 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<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
} 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() {
@ -327,7 +468,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
public void onJoinRoomSuccess(RCRTCRoom rcrtcRoom) {
// 主动订阅远端用户发布的资源
gameMicManager.subscribeAVStream();
// gameMicManager.subscribeAVStream();
}
@Override
@ -350,16 +491,28 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
}
});
LiveNetManager.get(mContext)
.joinMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
@Override
public void onPublishFailed() {
ToastUtil.show("发布失败 ");
ToastUtil.show(WordUtil.isNewZh() ? "語音加入失敗" : "Voice joining failed");
}
@Override
public void onSubscribeSuccess(List<RCRTCInputStream> inputStreamList) {
ToastUtil.show("订阅成功 ");
// ToastUtil.show("订阅成功 ");
}
@Override
@ -367,6 +520,22 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
ToastUtil.show("订阅失败 ");
}
@Override
public void onSubscribeSuccess(String userID, boolean mute, int position) {
runOnUiThread(new Runnable() {
@Override
public void run() {
sudGameUserListAdapter.muteUser(userID, mute, position);
}
});
}
@Override
public void onSubscribeFailed(String userID) {
ToastUtil.show("订阅失败 ");
}
@Override
public void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser) {
@ -382,6 +551,11 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
mLiveChatAdapter.insertItem(sudGameChatImModel);
}
@Override
public void refreshSudGameUserList(List<SudGameUserModel> personList) {
sudGameUserListAdapter.refreshSudGameUserList(personList);
}
@Override
public void onUnPublishStreamsSuccess() {
runOnUiThread(new Runnable() {
@ -392,6 +566,18 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
gameCloseWheat.setVisibility(View.INVISIBLE);
}
});
LiveNetManager.get(mContext)
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
@ -404,4 +590,31 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
public void onSudGameSocketImEvent(SudGameSocketImEvent event) {
gameMicManager.processingMessage(event);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameUserModel(SudGameUserModel model) {
if (model.isNullUser()) {
if (!publishDefault) {
if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
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 {
ToastUtil.show(WordUtil.isNewZh() ? "已經是上麥狀態" : "It is already in the wheat state");
}
}
}
}

View File

@ -554,6 +554,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.ai_te), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (TextUtils.equals(mLiveUid, "uid")) return;
if (!TextUtils.isEmpty(mUserBean.getId()) && !TextUtils.isEmpty(mUserBean.getUserNiceName())) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG)
@ -630,7 +631,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 跳转到个人主页
*/
private void forwardHomePage() {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
Constants.mStream = mStream;
RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0);
@ -640,11 +641,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 举报
*/
private void report() {
if (TextUtils.equals(mLiveUid, "uid")) return;
LiveReportActivity.forward(mContext, mToUid);
}
private void gotoLive(String live_id) {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.party_studio), new DialogUitl.SimpleCallback() {
@Override
@ -698,6 +701,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
setAttention();
} else if (i == R.id.btn_home_page) {
if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
MobclickAgent.onEvent(mContext, "anchor_avatar_index", "点主播主页");
} else {
@ -705,18 +709,22 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
forwardHomePage();
} else if (i == R.id.btn_report) {
if (TextUtils.equals(mLiveUid, "uid")) return;
report();
} else if (i == R.id.avatar) {
if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
MobclickAgent.onEvent(mContext, "anchor_avatar_btn", "点主播头像");
}
forwardHomePage();
} else if (i == R.id.btn_guard) {
if (TextUtils.equals(mLiveUid, "uid")) return;
MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮");
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity, mToUid);
} else if (i == R.id.btn_live) {
gotoLive(mToUid);
} else if (i == R.id.noble_icon_layout) {
if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
dismiss();
((LiveActivity) mContext).openFansWindow(mToUid);
@ -726,6 +734,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
.setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
}
} else if (i == R.id.btn_setting) {
if (TextUtils.equals(mLiveUid, "uid")) return;
setting();
}
}
@ -782,6 +791,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
if (TextUtils.equals(mLiveUid, "uid")) return;
if (tag == R.string.live_setting_kick) {
kick();
@ -815,6 +825,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 查看管理员列表
*/
private void adminList() {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
((LiveActivity) mContext).openAdminListWindow();
}
@ -823,6 +834,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 踢人
*/
private void kick() {
if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -839,6 +851,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 永久禁言->改成三天禁言
*/
private void setShutUp() {
if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -855,6 +868,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 本场禁言
*/
private void setShutUp2() {
if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -872,6 +886,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 设置或取消管理员
*/
private void setAdmin() {
if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -893,6 +908,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间
*/
private void closeLive() {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback);
}
@ -901,11 +917,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间并禁止主播直播
*/
private void closeLive2() {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback);
}
private void setShutUp3() {
if (TextUtils.equals(mLiveUid, "uid")) return;
new LiveSettingSilenceDialog(mContext)
.setItemClickListener((bean, position) -> {
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, bean + "", new HttpCallback() {
@ -927,6 +945,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间并禁用主播账户
*/
private void forbidAccount() {
if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback);
}

View File

@ -74,6 +74,7 @@ import com.yunbao.common.event.MainHomeCommunityToChatEvent;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.NoviceInstructorEvent;
import com.yunbao.common.event.RongIMConnectionStatusEvent;
import com.yunbao.common.event.SudGameUserEvent;
import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -103,7 +104,9 @@ import com.yunbao.common.views.APKUpdateCustomPopup;
import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.utils.LiveStorge;
import com.yunbao.main.R;
import com.yunbao.main.adapter.FullAdToBannerTransition;
@ -1426,6 +1429,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameUserEvent(SudGameUserEvent event) {
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveFloatEvent(LiveFloatEvent event) {
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
@ -1444,5 +1452,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
MobclickAgent.onEvent(mContext, "home_page_to_redpk", "首页点击右下角去红包专区");
mainHomeViewHolder.setCurPosition(3);
});
}
}

View File

@ -17,7 +17,7 @@ import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.SudGameActivity;
import com.yunbao.live.activity.SudGameActivity;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.adapter.SudGameListAdapter;
import com.yunbao.common.bean.CreateSudRoomModel;