修复多人连麦回到桌面再返回直播间丢失连麦图标问题
This commit is contained in:
parent
744de267dd
commit
7f001ba887
@ -1,12 +1,21 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LinkMicUserBean extends BaseModel {
|
||||
@SerializedName("user_nicename")
|
||||
private String uname;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("dress_avatar")
|
||||
private String dress_avatar;
|
||||
private String uid = "";
|
||||
private String action;
|
||||
@SerializedName("id")
|
||||
private String id;//连麦显示右侧头像时要用
|
||||
@SerializedName("level")
|
||||
private int level;
|
||||
@SerializedName("sex")
|
||||
private int sex;
|
||||
|
||||
public String getUname() {
|
||||
@ -64,4 +73,26 @@ public class LinkMicUserBean extends BaseModel {
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LinkMicUserBean{" +
|
||||
"uname='" + uname + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", dress_avatar='" + dress_avatar + '\'' +
|
||||
", uid='" + uid + '\'' +
|
||||
", action='" + action + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", level=" + level +
|
||||
", sex=" + sex +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LinkMicUserBeanV2 extends BaseModel {
|
||||
private String roomuserid;
|
||||
private int status;
|
||||
private List<LinkMicUserBean> userlist;
|
||||
|
||||
public String getRoomuserid() {
|
||||
return roomuserid;
|
||||
}
|
||||
|
||||
public void setRoomuserid(String roomuserid) {
|
||||
this.roomuserid = roomuserid;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<LinkMicUserBean> getUserlist() {
|
||||
return userlist;
|
||||
}
|
||||
|
||||
public void setUserlist(List<LinkMicUserBean> userlist) {
|
||||
this.userlist = userlist;
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.yunbao.live.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
public class MicUserBean {
|
||||
public class MicUserBean extends BaseModel{
|
||||
protected String id;
|
||||
protected String userNiceName;
|
||||
protected String avatar;
|
@ -10,6 +10,7 @@ import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
@ -173,10 +174,10 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<ActiveModel>>> getActiveList();
|
||||
|
||||
/**
|
||||
* 获取活动
|
||||
* 获取多人连麦列表
|
||||
*/
|
||||
@GET("/api/public/?service=live.getDrLm")
|
||||
Observable<ResponseModel<List<ActiveModel>>> getDrLm();
|
||||
Observable<ResponseModel<List<LinkMicUserBeanV2>>> getDrLm(@Query("uid")String uid);
|
||||
|
||||
/**
|
||||
* 获取日榜、周榜数据
|
||||
|
@ -11,6 +11,8 @@ import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
@ -23,6 +25,7 @@ import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -373,7 +376,7 @@ public class LiveNetManager {
|
||||
.subscribe(new Consumer<ResponseModel<EnterRoomNewModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<EnterRoomNewModel> enterRoomNewModelResponseModel) throws Exception {
|
||||
Log.e("进入房间","enterRoomNew--------------------------------------------");
|
||||
Log.e("进入房间", "enterRoomNew--------------------------------------------");
|
||||
enterRoomDisposable = null;
|
||||
if (callback != null) {
|
||||
callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo());
|
||||
@ -406,7 +409,7 @@ public class LiveNetManager {
|
||||
.subscribe(new Consumer<ResponseModel<String>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<String> stringResponseModel) throws Exception {
|
||||
Log.e("进入房间","userJoinRoomNew--------------------------------------------");
|
||||
Log.e("进入房间", "userJoinRoomNew--------------------------------------------");
|
||||
userJoinDisposable = null;
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@ -445,6 +448,39 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多人连麦用户列表
|
||||
*/
|
||||
public void getDRMicUserList(String uid, HttpCallback<List<LinkMicUserBean>> callback) {
|
||||
API.get().createPDLiveApi(false)
|
||||
.getDrLm(uid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<LinkMicUserBeanV2>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<LinkMicUserBeanV2>> listResponseModel) throws Exception {
|
||||
List<LinkMicUserBean> list=new ArrayList<>();
|
||||
for (LinkMicUserBeanV2 bean : listResponseModel.getData().getInfo()) {
|
||||
list.addAll(bean.getUserlist());
|
||||
for (LinkMicUserBean userBean : bean.getUserlist()) {
|
||||
Log.i("多人连麦", "list: " + userBean.toString());
|
||||
}
|
||||
}
|
||||
Log.i("多人连麦", "accept: " + list.size());
|
||||
if (callback != null) {
|
||||
callback.onSuccess(list);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -169,10 +169,10 @@ public class MicStatusManager {
|
||||
* 显示退出连麦状态对话框
|
||||
*/
|
||||
public void showDownMicDialog(Context context) {
|
||||
DialogUitl.showSimpleDialog(context, "當前正在連麥中,是否退出連麥", new DialogUitl.SimpleCallback() {
|
||||
DialogUitl.showSimpleDialog(context, "當前正在連麥中", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
downMic();
|
||||
// downMic(); //不做下麦跳转
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
@ -60,6 +61,7 @@ import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGuardBuyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGuardDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveInputDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMoreDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewGuardListDialogFragment;
|
||||
@ -96,6 +98,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
@ -146,7 +149,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
// public static boolean isRy = true;
|
||||
private List<String> outRankHide = new ArrayList<>();
|
||||
private boolean outRankHideFirst = true;
|
||||
|
||||
protected TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>();
|
||||
protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
|
||||
protected LiveMicAnchorDialogFragment.OnMicListener micListener = null;
|
||||
@Override
|
||||
protected void main() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
@ -1554,6 +1559,41 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开连麦UI
|
||||
*/
|
||||
protected void openMicWindow(int index) {
|
||||
LiveMicAnchorDialogFragment fragment = new LiveMicAnchorDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", index + "");
|
||||
fragment.setArguments(bundle);
|
||||
micListener = fragment.getMicListener();
|
||||
fragment.setMicQueueList(mMicQueueList);
|
||||
fragment.setAudienceList(mAudienceList);
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取连麦列表
|
||||
*/
|
||||
public void showMicList(String uid,LiveRoomViewHolder mLiveRoomViewHolder) {
|
||||
LiveNetManager.get(mContext)
|
||||
.getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback<List<LinkMicUserBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LinkMicUserBean> data) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.updataMicList(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
System.out.println("live.getDrLm error = " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
release();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.AudioManager;
|
||||
@ -41,8 +42,10 @@ import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.SlideInfoModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.EffectsSettingsDialog;
|
||||
@ -68,7 +71,9 @@ import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.ProcessResultUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.CustomDrawerPopupView;
|
||||
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
||||
import com.yunbao.common.views.weight.VerticalViewPager;
|
||||
@ -1132,7 +1137,60 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
case LUCKY_ANGEL:
|
||||
manager.luckyAngel(event.getMsgModel());
|
||||
break;
|
||||
|
||||
case LINK_MIC:
|
||||
if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) {
|
||||
mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject());
|
||||
}
|
||||
if (micListener != null) {
|
||||
micListener.updateMicList(mMicQueueList);
|
||||
DialogUitl.showSimpleDialog(mContext,
|
||||
String.format(WordUtil.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUname()),
|
||||
new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
openMicWindow(2);
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_CANCEL:
|
||||
mMicQueueList.remove(((LinkMicUserBean) event.getObject()).getUid());
|
||||
if (micListener != null) {
|
||||
micListener.updateMicList(mMicQueueList);
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_UPDATE_MIC_LIST:
|
||||
List<LinkMicUserBean> list = (List<LinkMicUserBean>) event.getObject();
|
||||
mMicQueueList.clear();
|
||||
for (LinkMicUserBean bean : list) {
|
||||
if (!StringUtil.isEmpty(bean.getUid())) {
|
||||
mMicQueueList.put(bean.getUid(), bean);
|
||||
}
|
||||
}
|
||||
if (micListener != null) {
|
||||
micListener.updateMicList(mMicQueueList);
|
||||
}
|
||||
if (manager.mLiveRoomViewHolder != null) {
|
||||
manager.mLiveRoomViewHolder.updataMicList(list);
|
||||
Log.i("多人连麦", "onOpenDrawer: "+list.size());
|
||||
for (LinkMicUserBean userBean : list) {
|
||||
Log.i("多人连麦", "u list: "+userBean.toString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_UPDATE_AUDIENCE_LIST:
|
||||
mAudienceList = (List<LiveUserGiftBean>) event.getObject();
|
||||
if (micListener != null) {
|
||||
micListener.updateAudienceList(mAudienceList);
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_CLOSE:
|
||||
if(manager.mLiveRoomViewHolder!=null){
|
||||
manager.mLiveRoomViewHolder.updataCleanMic();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.BitmapUtil;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
@ -66,7 +67,7 @@ import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
||||
@ -150,8 +151,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
public static int pk_nub;
|
||||
public static int backIndex = 0;//0=未判断,1=已判断
|
||||
private FaceManager manager;
|
||||
private TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>();
|
||||
private List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -240,7 +239,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
*/
|
||||
int mrr = 0;
|
||||
public int leave = 0;
|
||||
private LiveMicAnchorDialogFragment.OnMicListener micListener = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(int functionID) {
|
||||
@ -393,18 +392,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
}
|
||||
|
||||
private void openMicWindow(int index) {
|
||||
LiveMicAnchorDialogFragment fragment = new LiveMicAnchorDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", index+"");
|
||||
fragment.setArguments(bundle);
|
||||
micListener = fragment.getMicListener();
|
||||
fragment.setMicQueueList(mMicQueueList);
|
||||
fragment.setAudienceList(mAudienceList);
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播展示离开直播间
|
||||
@ -910,7 +897,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
mLivePushViewHolder = null;
|
||||
mLiveReadyViewHolder = null;
|
||||
mLiveAnchorViewHolder = null;
|
||||
if(MicStatusManager.getInstance().isAnchorOpenRoom()){
|
||||
if (MicStatusManager.getInstance().isAnchorOpenRoom()) {
|
||||
MicStatusManager.getInstance().closeMic(mContext);
|
||||
}
|
||||
L.e("LiveAnchorActivity-------onDestroy------->");
|
||||
@ -1363,6 +1350,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
if (micListener != null) {
|
||||
micListener.updateMicList(mMicQueueList);
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.updataMicList(list);
|
||||
Log.i("多人连麦", "onOpenDrawer: "+list.size());
|
||||
for (LinkMicUserBean userBean : list) {
|
||||
Log.i("多人连麦", "u list: "+userBean.toString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_UPDATE_AUDIENCE_LIST:
|
||||
mAudienceList = (List<LiveUserGiftBean>) event.getObject();
|
||||
@ -1370,9 +1364,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
micListener.updateAudienceList(mAudienceList);
|
||||
}
|
||||
break;
|
||||
case LINK_MIC_CLOSE:
|
||||
if(mLiveRoomViewHolder!=null){
|
||||
mLiveRoomViewHolder.updataCleanMic();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查指定直播间连麦人数
|
||||
*
|
||||
|
@ -31,15 +31,11 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.live.interfaces.LiveFunctionClickListener;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.yunbao.live.adapter;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.View;
|
||||
@ -24,7 +23,7 @@ import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
@ -32,7 +32,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.adapter.AnchorUserMicInfoAdapter;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
|
@ -32,7 +32,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.adapter.UserMicInfoAdapter;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
|
@ -193,6 +193,7 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
LINK_MIC_CANCEL(40, "取消连麦"),
|
||||
LINK_MIC_UPDATE_MIC_LIST(41, "更新连麦列表"),
|
||||
LINK_MIC_UPDATE_AUDIENCE_LIST(42, "更新观众/可邀请列表"),
|
||||
LINK_MIC_CLOSE(43, "主播关闭连麦房"),
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
@ -177,15 +177,16 @@ public class SocketRyClient {
|
||||
EventBus.getDefault().post("UsertoRY");
|
||||
} else if (actions == 5) {
|
||||
JSONObject mic_data = map.getJSONObject("ct");
|
||||
LiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist"));
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST)
|
||||
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class))
|
||||
);
|
||||
} else if (actions == 6) {
|
||||
ToastUtil.show("主播已關閉當前語音連麥功能");
|
||||
LiveRoomViewHolder.updataCleanMic();
|
||||
EventBus.getDefault().post("endMic");
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE)
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class)));
|
||||
} else if (actions == 8) {
|
||||
ToastUtil.show("您已被移出多人語音連麥");
|
||||
EventBus.getDefault().post("endMic");
|
||||
@ -195,15 +196,14 @@ public class SocketRyClient {
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class))
|
||||
);
|
||||
} else if (actions == 7) {//取消连麦
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL)
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case Constants.UP_USER_LIST:
|
||||
mListener.onUpUserList(map.getJSONObject("ct"));
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST)
|
||||
.setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class))
|
||||
);
|
||||
|
@ -611,6 +611,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
rcrtcRoom = null;
|
||||
MicStatusManager.getInstance().clear();
|
||||
ToastUtil.show("已成功退出語音連麥");
|
||||
if(onMicCallback!=null){
|
||||
onMicCallback.onMikUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -822,6 +825,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.e("ry", "切换成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
if(onMicCallback!=null){
|
||||
onMicCallback.onMikUpdate();
|
||||
}
|
||||
//遍历远端用户列表
|
||||
for (int i = 0; i < rcrtcRoom.getRemoteUsers().size(); i++) {
|
||||
Log.e("ry", rcrtcRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcRoom.getRemoteUsers().size());
|
||||
|
@ -14,6 +14,8 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements ILiveLinkMicViewHolder {
|
||||
protected LiveBean mLiveBean;
|
||||
|
||||
OnMicCallback onMicCallback;//连麦回调
|
||||
|
||||
public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
}
|
||||
@ -47,4 +49,18 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
||||
public void setLiveBean(LiveBean data) {
|
||||
this.mLiveBean = data;
|
||||
}
|
||||
|
||||
public OnMicCallback getOnMicCallback() {
|
||||
return onMicCallback;
|
||||
}
|
||||
|
||||
public void setOnMicCallback(OnMicCallback onMicCallback) {
|
||||
this.onMicCallback = onMicCallback;
|
||||
}
|
||||
|
||||
|
||||
public interface OnMicCallback{
|
||||
void onMikUpdate();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -64,10 +64,12 @@ import com.yunbao.common.bean.GuardUserModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.NewPeopleTaskModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
@ -260,9 +262,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
static ImageView pk5Ico;
|
||||
static RelativeLayout pk5;
|
||||
|
||||
static RelativeLayout mic_view;
|
||||
static RelativeLayout mic_view1;
|
||||
static RelativeLayout mic_view2;
|
||||
RelativeLayout mic_view;
|
||||
RelativeLayout mic_view1;
|
||||
RelativeLayout mic_view2;
|
||||
|
||||
static ImageView mic_ico;
|
||||
static RoundedImageView mic_ico1;
|
||||
@ -340,26 +342,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
|
||||
//更新连麦人
|
||||
public static List<String> mic_ids = new ArrayList<>();
|
||||
public List<String> mic_ids = new ArrayList<>();
|
||||
|
||||
public static void updataMicList(JSONArray obj) {
|
||||
public void updataMicList(List<LinkMicUserBean> list) {
|
||||
mic_ids.clear();
|
||||
updataCleanMic();
|
||||
//拿到原始数据
|
||||
for (int j = 0; j < obj.size(); j++) {
|
||||
JSONObject mic = obj.getJSONObject(j);
|
||||
if (j == 1) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
LinkMicUserBean bean=list.get(i);
|
||||
if(i==1){
|
||||
mic_view.setVisibility(View.VISIBLE);
|
||||
mic_ids.add(mic.getString("id"));
|
||||
ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico);
|
||||
} else if (j == 2) {
|
||||
mic_ids.add(bean.getId());
|
||||
ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico);
|
||||
}else if(i==2){
|
||||
mic_view1.setVisibility(View.VISIBLE);
|
||||
mic_ids.add(mic.getString("id"));
|
||||
ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico1);
|
||||
} else if (j == 3) {
|
||||
mic_ids.add(bean.getId());
|
||||
ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico1);
|
||||
}else if(i==3){
|
||||
mic_view2.setVisibility(View.VISIBLE);
|
||||
mic_ids.add(mic.getString("id"));
|
||||
ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico2);
|
||||
mic_ids.add(bean.getId());
|
||||
ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico2);
|
||||
}
|
||||
}
|
||||
mic_view.setOnClickListener(new View.OnClickListener() {
|
||||
@ -382,7 +384,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
});
|
||||
}
|
||||
|
||||
public static void updataCleanMic() {
|
||||
public void updataCleanMic() {
|
||||
mic_view.setVisibility(View.GONE);
|
||||
mic_view1.setVisibility(View.GONE);
|
||||
mic_view2.setVisibility(View.GONE);
|
||||
|
@ -132,7 +132,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
//直播间拆分布局
|
||||
private LiveRoomPlayViewHolder mLivePlayViewHolder;
|
||||
//头部布局
|
||||
private LiveRoomViewHolder mLiveRoomViewHolder;
|
||||
public LiveRoomViewHolder mLiveRoomViewHolder;
|
||||
//底部布局
|
||||
public LiveAudienceViewHolder mLiveAudienceViewHolder;
|
||||
//观众与主播连麦逻辑
|
||||
@ -265,6 +265,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLivePlayViewHolder.setLiveBean(data);
|
||||
mLivePlayViewHolder.setCover(data.getThumb());
|
||||
mLivePlayViewHolder.play(data.getPull());
|
||||
mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
|
||||
@Override
|
||||
public void onMikUpdate() {
|
||||
if(mContext instanceof LiveActivity) {
|
||||
((LiveActivity) mContext).showMicList(mLiveBean.getUid(),mLiveRoomViewHolder);
|
||||
}
|
||||
}
|
||||
});
|
||||
mLiveRoomViewHolder.resetView();
|
||||
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
||||
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
|
||||
@ -512,7 +520,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
}
|
||||
});
|
||||
if(mContext instanceof LiveActivity) {
|
||||
((LiveActivity) mContext).showMicList(mLiveBean.getUid(),mLiveRoomViewHolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void removeLiveEnd() {
|
||||
if (mLiveAudienceViewHolder != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user