Android连麦申请列表重构,申请列表重构,连麦列表重构,按钮判断逻辑修改,主播断开连麦接口重构
This commit is contained in:
parent
a39005b1a9
commit
f1a8cd3a68
@ -71,6 +71,38 @@ public class UserBean implements Parcelable {
|
||||
//粉丝团等级
|
||||
private int fansLevel;
|
||||
//粉丝团进场皮肤
|
||||
protected int typeMic;
|
||||
private boolean isMicList = false;
|
||||
|
||||
private boolean isRequest = false;
|
||||
|
||||
public boolean isRequest() {
|
||||
return isRequest;
|
||||
}
|
||||
|
||||
public UserBean setRequest(boolean request) {
|
||||
isRequest = request;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMicList() {
|
||||
return isMicList;
|
||||
}
|
||||
|
||||
public UserBean setMicList(boolean micList) {
|
||||
isMicList = micList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getTypeMic() {
|
||||
return typeMic;
|
||||
}
|
||||
|
||||
public UserBean setTypeMic(int typeMic) {
|
||||
this.typeMic = typeMic;
|
||||
return this;
|
||||
}
|
||||
|
||||
private String fansEnterRoomUrl;
|
||||
|
||||
public int getUserInfoComplete() {
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 连麦用户申请列表维护
|
||||
*/
|
||||
public class MicUserManager extends BaseCacheManager {
|
||||
private String micKey = "TYPE_MIC_REQUEST";
|
||||
private List<UserBean> micUsers = new ArrayList<>();
|
||||
private static MicUserManager manager;
|
||||
|
||||
public MicUserManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public static MicUserManager get() {
|
||||
if (null == manager) {
|
||||
manager = new MicUserManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void upDataMicUser(JSONObject map) {
|
||||
UserBean userModel = new UserBean();
|
||||
|
||||
UserBean.DressBean dressAvatar = null;
|
||||
if (!TextUtils.isEmpty(map.getString("dress_avatar"))) {
|
||||
dressAvatar = new UserBean.DressBean();
|
||||
dressAvatar.setAvatar_frame(map.getString("dress_avatar"));
|
||||
}
|
||||
|
||||
userModel.setAvatar(map.getString("avatar"));
|
||||
userModel.setId(map.getString("uid"));
|
||||
userModel.setUserNiceName(map.getString("uname"));
|
||||
userModel.setDress(dressAvatar);
|
||||
userModel.setSex(map.getIntValue("sex"));
|
||||
userModel.setLevel(map.getIntValue("level"));
|
||||
userModel.setTypeMic(2);
|
||||
micUsers.add(userModel);
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public List<UserBean> getMicUserList() {
|
||||
if (micUsers.size() < 1) {
|
||||
micUsers = getList(micKey, new TypeToken<List<UserBean>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
return micUsers;
|
||||
}
|
||||
|
||||
public void removeMiscUser(JSONObject map) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), map.getString("uid"))) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeMiscUser(String uid) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), uid)) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeAllMicUserList() {
|
||||
deleteByKey(micKey);
|
||||
micUsers.clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 处于连麦中的人员维护列表
|
||||
*/
|
||||
public class MicedUserManager extends BaseCacheManager {
|
||||
private String micKey = "TYPE_MIC_LIST";
|
||||
private List<UserBean> micUsers = new ArrayList<>();
|
||||
|
||||
public MicedUserManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private static MicedUserManager manager;
|
||||
|
||||
|
||||
public static MicedUserManager get() {
|
||||
if (null == manager) {
|
||||
manager = new MicedUserManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
||||
public void upDataMicUserList(List<LinkMicUserBean> list) {
|
||||
if (list == null || list.size() < 1) return;
|
||||
for (LinkMicUserBean linkMicUserBean : list) {
|
||||
if (!TextUtils.equals(linkMicUserBean.getId(),
|
||||
String.valueOf(IMLoginManager.get(
|
||||
CommonAppContext.sInstance.getBaseContext()).
|
||||
getUserInfo().getId()))) {
|
||||
|
||||
UserBean userModel = new UserBean();
|
||||
UserBean.DressBean dressAvatar = null;
|
||||
if (!TextUtils.isEmpty(linkMicUserBean.getDress_avatar())) {
|
||||
dressAvatar = new UserBean.DressBean();
|
||||
dressAvatar.setAvatar_frame(linkMicUserBean.getDress_avatar());
|
||||
}
|
||||
|
||||
userModel.setAvatar(linkMicUserBean.getAvatar());
|
||||
userModel.setId(linkMicUserBean.getId());
|
||||
userModel.setUserNiceName(linkMicUserBean.getUname());
|
||||
userModel.setSex(linkMicUserBean.getSex());
|
||||
userModel.setDress(dressAvatar);
|
||||
userModel.setLevel(linkMicUserBean.getLevel());
|
||||
userModel.setTypeMic(1);
|
||||
micUsers.add(userModel);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeMiscUser(String uid) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), uid)) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public List<UserBean> getMicUserList() {
|
||||
if (micUsers.size() < 1) {
|
||||
micUsers = getList(micKey, new TypeToken<List<UserBean>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
return micUsers;
|
||||
}
|
||||
|
||||
public void removeAllMicUserList() {
|
||||
deleteByKey(micKey);
|
||||
micUsers.clear();
|
||||
}
|
||||
}
|
@ -1,9 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="76dp" android:height="27dp">
|
||||
<item android:width="76dp" android:height="27dp" android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff40beff" />
|
||||
<corners android:topLeftRadius="13dp" android:topRightRadius="13dp" android:bottomLeftRadius="13dp" android:bottomRightRadius="13dp" />
|
||||
<corners android:bottomLeftRadius="13dp" android:bottomRightRadius="13dp" android:topLeftRadius="13dp" android:topRightRadius="13dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:width="76dp" android:height="27dp" android:state_selected="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#4A4A4A" />
|
||||
<corners android:bottomLeftRadius="13dp" android:bottomRightRadius="13dp" android:topLeftRadius="13dp" android:topRightRadius="13dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -1745,7 +1745,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
if (liveSudGamePopupXPopup != null) {
|
||||
liveSudGamePopupXPopup.BusGetOff();
|
||||
liveSudGamePopupXPopup.dialog.dismiss();
|
||||
|
||||
verticalViewPager.setEnableScroll(true);
|
||||
liveSudGamePopupXPopup = null;
|
||||
}
|
||||
break;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -20,20 +21,20 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
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.LiveRyAnchorActivity;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.live.interfaces.LiveFunctionClickListener;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
@ -49,7 +50,7 @@ import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
public static final int TYPE_MIC_LIST = 1;//连麦列表
|
||||
public static final int TYPE_MIC_REQUEST = 2;//请求连麦
|
||||
public static final int TYPE_MIC_INVITE = 3;//邀请连麦
|
||||
@ -116,40 +117,42 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
mBtn = itemView.findViewById(R.id.mic_btn);
|
||||
mClose = itemView.findViewById(R.id.mic_exit);
|
||||
mBtn.setOnClickListener(v -> {
|
||||
if (MicedUserManager.get().getMicUserList().size() < 3) {
|
||||
if (v.getTag() != null) {
|
||||
MicUserBean tag = (MicUserBean) v.getTag();
|
||||
LiveRyAnchorActivity.checkMicUserLength(mLiveUid, new LiveFunctionClickListener() {
|
||||
@Override
|
||||
public void onClick(int length) {
|
||||
//只允许最多3人连麦(加主播4人)
|
||||
if (length <= 4) {
|
||||
if (tag.getType() == TYPE_MIC_REQUEST) {
|
||||
applyMic(tag, 4, createSocketSendBean());
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
||||
} else if (tag.getType() == TYPE_MIC_INVITE) {
|
||||
UserBean tag = (UserBean) v.getTag();
|
||||
if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||
SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId());
|
||||
applyMic(tag, 1, bean);
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_invite));
|
||||
} else if (tag.getTypeMic() == TYPE_MIC_INVITE) {
|
||||
applyMic(tag, 4, createSocketSendBean());
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
||||
for (int i = 0; i < mList.size(); i++) {
|
||||
if (TextUtils.equals(mList.get(i).getId(), tag.getId())) {
|
||||
mList.get(i).setRequest(true);
|
||||
notifyItemChanged(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_max));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
mClose.setOnClickListener(v -> {
|
||||
if (v.getTag() != null) {
|
||||
API.get().createPDLiveApi(true)
|
||||
.killDrLm(((MicUserBean) v.getTag()).getId(), mLiveUid)
|
||||
API.get().createPDLiveApi(false)
|
||||
.killDrLm(((UserBean) v.getTag()).getId(), mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> stringResponseModel) throws Exception {
|
||||
applyMic((MicUserBean) v.getTag(), 8, createSocketSendBean());
|
||||
applyMic((UserBean) v.getTag(), 8, createSocketSendBean());
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_user_down));
|
||||
refreshView.initData();
|
||||
}
|
||||
}, Throwable::printStackTrace).isDisposed();
|
||||
|
||||
@ -167,9 +170,10 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
|
||||
/**
|
||||
* 发送IM消息
|
||||
*
|
||||
* @param action 4为同意请求,1为邀请,其余见 {@link com.yunbao.live.socket.SocketRyClient} Constants.LIAN_MAI解析
|
||||
*/
|
||||
void applyMic(MicUserBean bean, int action, SocketSendBean msg) {
|
||||
void applyMic(UserBean bean, int action, SocketSendBean msg) {
|
||||
msg.param("action", action);
|
||||
msg.create();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
@ -184,9 +188,17 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
refreshView.initData();
|
||||
|
||||
IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null);
|
||||
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
|
||||
if (bean.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||
MicUserManager.get().removeMiscUser(bean.getId());
|
||||
}
|
||||
if (bean.getTypeMic() == TYPE_MIC_LIST && action == 8) {
|
||||
MicedUserManager.get().removeMiscUser(bean.getId());
|
||||
}
|
||||
|
||||
refreshView.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -197,9 +209,9 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
});
|
||||
}
|
||||
|
||||
void setData(final MicUserBean bean, int position) {
|
||||
void setData(final UserBean bean, int position) {
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
mAvatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((LiveActivity) mContext).showUserDialog(bean.getId());
|
||||
@ -208,7 +220,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
});
|
||||
mClose.setTag(bean);
|
||||
mBtn.setTag(bean);
|
||||
switch (bean.getType()) {
|
||||
switch (bean.getTypeMic()) {
|
||||
case TYPE_MIC_LIST:
|
||||
mClose.setVisibility(View.VISIBLE);
|
||||
mBtn.setVisibility(View.GONE);
|
||||
@ -219,29 +231,46 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
mBtn.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
if (bean.getType() == TYPE_MIC_REQUEST) {
|
||||
if (bean.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||
mBtn.setText("同意");
|
||||
if (!WordUtil.isNewZh()) {
|
||||
mBtn.setText("agree");
|
||||
}
|
||||
mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok);
|
||||
} else if (bean.getType() == TYPE_MIC_INVITE) {
|
||||
mBtn.setText("邀请");
|
||||
if (!WordUtil.isNewZh()) {
|
||||
mBtn.setText("invite");
|
||||
}
|
||||
} else if (bean.getTypeMic() == TYPE_MIC_INVITE) {
|
||||
|
||||
|
||||
mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite);
|
||||
if (bean.isMicList()) {
|
||||
mBtn.setEnabled(false);
|
||||
mBtn.setClickable(false);
|
||||
mBtn.setSelected(false);
|
||||
mBtn.setText(WordUtil.isNewZh() ? "連麥中" : "Trung");
|
||||
} else {
|
||||
mBtn.setEnabled(true);
|
||||
mBtn.setClickable(true);
|
||||
mBtn.setSelected(true);
|
||||
// if (bean.isRequest()){
|
||||
// mBtn.setText(WordUtil.isNewZh() ? "已邀请" : "Invited");
|
||||
// }else {
|
||||
mBtn.setText(WordUtil.isNewZh() ? "邀请" : "invite");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
|
||||
if (bean.getDress_avatar() != null) {
|
||||
if (bean.getDress_avatar().contains("svga")) {
|
||||
gift_svga.setImageDrawable(null);
|
||||
if (bean.getDress() != null) {
|
||||
if (bean.getDress().getAvatar_frame().contains("svga")) {
|
||||
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(bean.getDress_avatar()), new SVGAParser.ParseCompletion() {
|
||||
new SVGAParser(mContext).parse(new URL(bean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
SVGAViewUtils.playEndClear(gift_svga);
|
||||
SVGAViewUtils.playEndClear(gift_svga, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -252,10 +281,9 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
ImgLoader.display(mContext, bean.getDress_avatar(), gift_svga);
|
||||
ImgLoader.display2(mContext, bean.getDress().getAvatar_frame(), gift_svga);
|
||||
}
|
||||
}
|
||||
|
||||
mName.setText(bean.getUserNiceName());
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
@ -263,8 +291,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.app.ActionBar;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@ -20,23 +21,23 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
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.common.bean.MicUserBean;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -58,19 +59,15 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
private AnchorUserMicInfoAdapter userMicInfoAdapter;
|
||||
private String mLiveUid;
|
||||
private String stream;
|
||||
private LiveGuardInfo mLiveGuardInfo;
|
||||
public static LiveActivity activity = null;
|
||||
public eightbitlab.com.blurview.BlurView blurView;
|
||||
|
||||
public TextView listMicbtn, requestMicBtn, inviteMicBtn, mDisconnectMic;
|
||||
private TextView mNoMoreDesc;
|
||||
private String Tips = "1";
|
||||
private String type = "guanzhong";
|
||||
View mOpenMicLayout, no_more;
|
||||
View mOpenMicBtn;
|
||||
private TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>();
|
||||
private List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
|
||||
private LiveImDeletUtil liveImDeletUtil;
|
||||
private OnMicListener micListener;
|
||||
|
||||
@Override
|
||||
@ -97,9 +94,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
public void setLiveGuardInfo(LiveGuardInfo info) {
|
||||
mLiveGuardInfo = info;
|
||||
}
|
||||
|
||||
public void setMicQueueList(TreeMap<String, LinkMicUserBean> mMicQueueList) {
|
||||
this.mMicQueueList = mMicQueueList;
|
||||
@ -142,8 +136,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
if (bundle == null) {
|
||||
return;
|
||||
}
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
|
||||
mLiveUid = bundle.getString(Constants.LIVE_UID);
|
||||
stream = bundle.getString(Constants.STREAM);
|
||||
listMicbtn = mRootView.findViewById(R.id.audience_btn);
|
||||
@ -168,9 +160,11 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
return;
|
||||
}
|
||||
Tips = "1";
|
||||
//
|
||||
userMicInfoAdapter.clearData();
|
||||
Up();
|
||||
type = "guanzhong";
|
||||
mRefreshView.initData();
|
||||
|
||||
});
|
||||
requestMicBtn.setOnClickListener(view -> {
|
||||
if (!MicStatusManager.getInstance().isAnchorOpenRoom()) {
|
||||
@ -178,7 +172,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
}
|
||||
Tips = "2";
|
||||
Up();
|
||||
type = "guard";
|
||||
mRefreshView.initData();
|
||||
});
|
||||
|
||||
@ -188,9 +181,9 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
return;
|
||||
}
|
||||
Tips = "3";
|
||||
Up();
|
||||
type = "fans";
|
||||
|
||||
mRefreshView.initData();
|
||||
Up();
|
||||
});
|
||||
mOpenMicBtn.setOnClickListener(v -> {
|
||||
API.get().pdLiveApi(mContext)
|
||||
@ -204,7 +197,7 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
mRefreshView.setVisibility(View.VISIBLE);
|
||||
mDisconnectMic.setVisibility(View.VISIBLE);
|
||||
MicStatusManager.getInstance().setAnchorOpenRoom(true);
|
||||
mRefreshView.initData();
|
||||
// mRefreshView.initData();
|
||||
}
|
||||
}, Throwable::printStackTrace)
|
||||
.isDisposed();
|
||||
@ -222,7 +215,10 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
MicStatusManager.getInstance().closeMic(mContext);
|
||||
MicUserManager.get().removeAllMicUserList();
|
||||
LiveMicAnchorDialogFragment.this.dismiss();
|
||||
MicedUserManager.get().removeAllMicUserList();
|
||||
MicUserManager.get().removeAllMicUserList();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -231,10 +227,11 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
userMicInfoAdapter.setLiveUid(mLiveUid);
|
||||
userMicInfoAdapter.setRefreshView(mRefreshView);
|
||||
Up();
|
||||
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<MicUserBean>() {
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<UserBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<MicUserBean> getAdapter() {
|
||||
public RefreshAdapter<UserBean> getAdapter() {
|
||||
userMicInfoAdapter.notifyDataSetChanged();
|
||||
return userMicInfoAdapter;
|
||||
}
|
||||
@ -242,55 +239,45 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
Log.e("tag111", p + "ssss");
|
||||
LiveHttpUtil.getMicList(mLiveUid, p, callback);
|
||||
LiveHttpUtil.getUserList(mLiveUid, stream, "guanzhong", p, callback);
|
||||
pg = p;
|
||||
if (p == 1) {
|
||||
no_more.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MicUserBean> processData(String[] info) {
|
||||
public List<UserBean> processData(String[] info) {
|
||||
Log.e("tag222", Tips + "ssss" + MicStatusManager.getInstance().toString());
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
List<MicUserBean> data = new ArrayList<>();
|
||||
List<UserBean> data = new ArrayList<>();
|
||||
if (TextUtils.equals(Tips, "2")) {
|
||||
|
||||
userMicInfoAdapter.clearData();
|
||||
data = MicUserManager.get().getMicUserList();
|
||||
|
||||
if (data.size() == 0) {
|
||||
no_more.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.GONE);
|
||||
|
||||
if (Tips.equals("2")) {
|
||||
for (String uid : mMicQueueList.keySet()) {
|
||||
LinkMicUserBean userBean = mMicQueueList.get(uid);
|
||||
MicUserBean bean = new MicUserBean();
|
||||
bean.setAvatar(userBean.getAvatar());
|
||||
bean.setId(uid);
|
||||
bean.setUserNiceName(userBean.getUname());
|
||||
bean.setSex(userBean.getSex());
|
||||
bean.setDress_avatar(userBean.getDress_avatar());
|
||||
bean.setLevel(userBean.getLevel());
|
||||
bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_REQUEST);
|
||||
data.add(bean);
|
||||
}
|
||||
} else if ("3".equals(Tips)) {
|
||||
for (LiveUserGiftBean userBean : mAudienceList) {
|
||||
MicUserBean bean = new MicUserBean();
|
||||
bean.setAvatar(userBean.getAvatar());
|
||||
bean.setId(userBean.getId());
|
||||
bean.setUserNiceName(userBean.getUserNiceName());
|
||||
bean.setSex(userBean.getSex());
|
||||
bean.setDress_avatar(userBean.getDress().getAvatar_frame());
|
||||
bean.setLevel(userBean.getLevel());
|
||||
bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_INVITE);
|
||||
data.add(bean);
|
||||
}
|
||||
mRefreshView.setNotLoadMore();
|
||||
}else {
|
||||
data = JSON.parseArray(obj.getString("userlist"), MicUserBean.class);
|
||||
for (MicUserBean bean : data) {
|
||||
bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_LIST);
|
||||
mRefreshView.setVisibility(View.VISIBLE);
|
||||
no_more.setVisibility(View.GONE);
|
||||
}
|
||||
if (data.size() != 0) {
|
||||
data.remove(0);
|
||||
mRefreshView.mRecyclerView.getRecycledViewPool().setMaxRecycledViews(0, data.size());
|
||||
} else if (TextUtils.equals(Tips, "3")) {
|
||||
data = JSON.parseArray(obj.getString("userlist"), UserBean.class);
|
||||
for (UserBean bean : data) {
|
||||
bean.setTypeMic(AnchorUserMicInfoAdapter.TYPE_MIC_INVITE);
|
||||
for (UserBean model : MicedUserManager.get().getMicUserList()) {
|
||||
if (!bean.isMicList() && TextUtils.equals(bean.getId(), model.getId())) {
|
||||
bean.setMicList(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (pg == 1 && data.size() == 0) {
|
||||
no_more.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.GONE);
|
||||
}
|
||||
if (data.size() > 0 && pg == 1) {
|
||||
nums = 0;
|
||||
view_no.setVisibility(View.GONE);
|
||||
@ -301,11 +288,60 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
mRefreshView.setVisibility(View.VISIBLE);
|
||||
no_more.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (TextUtils.equals(Tips, "1")) {
|
||||
userMicInfoAdapter.clearData();
|
||||
data = MicedUserManager.get().getMicUserList();
|
||||
|
||||
if (data.size() == 0) {
|
||||
no_more.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.GONE);
|
||||
|
||||
}else {
|
||||
mRefreshView.setVisibility(View.VISIBLE);
|
||||
no_more.setVisibility(View.GONE);
|
||||
}
|
||||
mRefreshView.mRecyclerView.getRecycledViewPool().setMaxRecycledViews(0, data.size());
|
||||
}
|
||||
|
||||
|
||||
// if (Tips.equals("2")) {
|
||||
// for (String uid : mMicQueueList.keySet()) {
|
||||
// LinkMicUserBean userBean = mMicQueueList.get(uid);
|
||||
// MicUserBean bean = new MicUserBean();
|
||||
// bean.setAvatar(userBean.getAvatar());
|
||||
// bean.setId(uid);
|
||||
// bean.setUserNiceName(userBean.getUname());
|
||||
// bean.setSex(userBean.getSex());
|
||||
// bean.setDress_avatar(userBean.getDress_avatar());
|
||||
// bean.setLevel(userBean.getLevel());
|
||||
// bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_REQUEST);
|
||||
// data.add(bean);
|
||||
// }
|
||||
// } else if ("3".equals(Tips)) {
|
||||
// for (LiveUserGiftBean userBean : mAudienceList) {
|
||||
// MicUserBean bean = new MicUserBean();
|
||||
// bean.setAvatar(userBean.getAvatar());
|
||||
// bean.setId(userBean.getId());
|
||||
// bean.setUserNiceName(userBean.getUserNiceName());
|
||||
// bean.setSex(userBean.getSex());
|
||||
// bean.setDress_avatar(userBean.getDress().getAvatar_frame());
|
||||
// bean.setLevel(userBean.getLevel());
|
||||
// bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_INVITE);
|
||||
// data.add(bean);
|
||||
// }
|
||||
// mRefreshView.setNotLoadMore();
|
||||
// } else {
|
||||
|
||||
// if (data.size() != 0) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<MicUserBean> list, int listCount) {
|
||||
public void onRefreshSuccess(List<UserBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@ -315,7 +351,7 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<MicUserBean> loadItemList, int loadItemCount) {
|
||||
public void onLoadMoreSuccess(List<UserBean> loadItemList, int loadItemCount) {
|
||||
Log.e("tag333", "是" + nums);
|
||||
}
|
||||
|
||||
@ -323,7 +359,9 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
public void onLoadMoreFailure() {
|
||||
}
|
||||
});
|
||||
|
||||
initData();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -333,7 +371,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mLiveGuardInfo = null;
|
||||
LiveHttpUtil.cancel("getUserLists");
|
||||
super.onDestroy();
|
||||
}
|
||||
@ -344,7 +381,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
requestMicBtn.setTextColor(Color.parseColor("#ff646464"));
|
||||
inviteMicBtn.setTextColor(Color.parseColor("#ff646464"));
|
||||
mNoMoreDesc.setText(R.string.no_more_mic);
|
||||
type = "guanzhong";
|
||||
} else if (Tips.equals("2")) {
|
||||
listMicbtn.setTextColor(Color.parseColor("#ff646464"));
|
||||
requestMicBtn.setTextColor(Color.parseColor("#fff6f7fb"));
|
||||
@ -353,7 +389,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
if (!WordUtil.isNewZh()) {
|
||||
mNoMoreDesc.setText("No one has applied at the moment");
|
||||
}
|
||||
type = "guard";
|
||||
} else if (Tips.equals("3")) {
|
||||
listMicbtn.setTextColor(Color.parseColor("#ff646464"));
|
||||
requestMicBtn.setTextColor(Color.parseColor("#ff646464"));
|
||||
@ -362,7 +397,6 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
||||
if (!WordUtil.isNewZh()) {
|
||||
mNoMoreDesc.setText("No audience at the moment");
|
||||
}
|
||||
type = "fans";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,8 @@ import com.yunbao.common.event.SendBlindGiftEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
import com.yunbao.common.manager.NewLevelManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
@ -199,6 +201,7 @@ public class SocketRyClient {
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST)
|
||||
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class))
|
||||
);
|
||||
MicedUserManager.get().upDataMicUserList(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class));
|
||||
} else if (actions == 6) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("主播已關閉當前語音連麥功能");
|
||||
@ -221,10 +224,12 @@ public class SocketRyClient {
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC)
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class))
|
||||
);
|
||||
MicUserManager.get().upDataMicUser(map);
|
||||
} else if (actions == 7) {//取消连麦
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL)
|
||||
);
|
||||
MicUserManager.get().removeMiscUser(map);
|
||||
}
|
||||
break;
|
||||
case Constants.UP_USER_LIST:
|
||||
|
Loading…
Reference in New Issue
Block a user