点击【邀请】加上防抖的功能

This commit is contained in:
18142669586 2024-05-28 16:58:39 +08:00
parent 0afee3543e
commit 01dfb81a46
3 changed files with 31 additions and 38 deletions

View File

@ -216,7 +216,7 @@ public interface PDLiveApi {
); );
/** /**
* 关注主播 * 关注主播···································································
* *
* @param liveuid * @param liveuid
* @return * @return

View File

@ -121,11 +121,12 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga); gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga);
mBtn = itemView.findViewById(R.id.mic_btn); mBtn = itemView.findViewById(R.id.mic_btn);
mClose = itemView.findViewById(R.id.mic_exit); mClose = itemView.findViewById(R.id.mic_exit);
mBtn.setOnClickListener(v -> { ViewClicksAntiShake.clicksAntiShake(mBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
if (MicedUserManager.get().getMicUserList().size() < 3) { @Override
if (v.getTag() != null) { public void onViewClicks() {
UserBean tag = (UserBean) v.getTag(); if (MicedUserManager.get().getMicUserList().size() < 3) {
ViewClicksAntiShake.clicksAntiShake(mBtn, () -> { if (mBtn.getTag() != null) {
UserBean tag = (UserBean) mBtn.getTag();
if (tag.getTypeMic() == TYPE_MIC_REQUEST) { if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
applyMic(tag, 4, createSocketSendBean()); applyMic(tag, 4, createSocketSendBean());
ToastUtil.show(mContext.getString(R.string.live_mic_request)); ToastUtil.show(mContext.getString(R.string.live_mic_request));
@ -140,12 +141,14 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
applyMic(tag, 1, bean); applyMic(tag, 1, bean);
ToastUtil.show(mContext.getString(R.string.live_mic_invite)); ToastUtil.show(mContext.getString(R.string.live_mic_invite));
} }
}); }
}else {
ToastUtil.show(mContext.getString(R.string.live_mic_max));
} }
}else {
ToastUtil.show(mContext.getString(R.string.live_mic_max));
} }
}); });
mClose.setOnClickListener(v -> { mClose.setOnClickListener(v -> {
if (v.getTag() != null) { if (v.getTag() != null) {
API.get().createPDLiveApi(false) API.get().createPDLiveApi(false)

View File

@ -690,43 +690,33 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
mIsApplyDialogShow = false; mIsApplyDialogShow = false;
return; return;
} }
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
msg1.create();
String targetId = u.getId();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override @Override
public void onFailed(RTCErrorCode errorCode) { public void onAttached(io.rong.imlib.model.Message message) {
} }
@Override @Override
public void onSuccess() { public void onSuccess(io.rong.imlib.model.Message message) {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
msg1.create();
String targetId = u.getId(); Log.e("ry", "发送成功");
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; if (SocketSwClient.mSocketHandler != null) {
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); }
}
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override
@Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
public void onAttached(io.rong.imlib.model.Message message) { Log.e("ry", "发送失敗" + u.getId());
}
@Override
public void onSuccess(io.rong.imlib.model.Message message) {
Log.e("ry", "发送成功");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
}
}
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("ry", "发送失敗" + u.getId());
}
});
} }
}); });