调整多人连麦踢人后刷新列表

This commit is contained in:
zlzw 2022-11-23 14:42:00 +08:00
parent 3d117dbcb4
commit d42835231e
2 changed files with 19 additions and 9 deletions

View File

@ -20,6 +20,7 @@ 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.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
@ -52,6 +53,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
public static final int TYPE_MIC_INVITE = 3;//邀请连麦
private AbsDialogFragment fragments;
private CommonRefreshView refreshView;
private String mLiveUid;
public AnchorUserMicInfoAdapter(Context context, AbsDialogFragment fragment) {
@ -62,10 +64,13 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
@Override
public int getItemViewType(int position) {
return position;
}
public void setRefreshView(CommonRefreshView refreshView) {
this.refreshView = refreshView;
}
public void setLiveUid(String mLiveUid) {
this.mLiveUid = mLiveUid;
}
@ -111,11 +116,11 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
mBtn.setOnClickListener(v -> {
if (v.getTag() != null) {
MicUserBean tag = (MicUserBean) v.getTag();
if(tag.getType()==TYPE_MIC_REQUEST) {
applyMic(tag, 4,createSocketSendBean());
}else if(tag.getType()==TYPE_MIC_INVITE){
if (tag.getType() == TYPE_MIC_REQUEST) {
applyMic(tag, 4, createSocketSendBean());
} else if (tag.getType() == TYPE_MIC_INVITE) {
SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId());
applyMic(tag, 1,bean);
applyMic(tag, 1, bean);
}
}
});
@ -128,21 +133,23 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
@Override
public void accept(ResponseModel<BaseModel> stringResponseModel) throws Exception {
applyMic((MicUserBean) v.getTag(), 8,createSocketSendBean());
applyMic((MicUserBean) v.getTag(), 8, createSocketSendBean());
}
}, Throwable::printStackTrace).isDisposed();
}
});
}
SocketSendBean createSocketSendBean(){
return new SocketSendBean()
SocketSendBean createSocketSendBean() {
return new SocketSendBean()
.param("_method_", Constants.LIAN_MAI)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("uid", CommonAppConfig.getInstance().getUid());
}
void applyMic(MicUserBean bean, int action,SocketSendBean msg) {
void applyMic(MicUserBean bean, int action, SocketSendBean msg) {
msg.param("action", action);
msg.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
@ -157,12 +164,14 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
@Override
public void onSuccess(io.rong.imlib.model.Message message) {
Log.e("ry", "发送成功");
refreshView.initData();
}
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("ry", "发送失敗" + errorCode.toString());
refreshView.initData();
}
});
}

View File

@ -224,6 +224,7 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
});
userMicInfoAdapter = new AnchorUserMicInfoAdapter(mContext, LiveMicAnchorDialogFragment.this);
userMicInfoAdapter.setLiveUid(mLiveUid);
userMicInfoAdapter.setRefreshView(mRefreshView);
Up();
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<MicUserBean>() {