From 01dfb81a46c3762b16bcb0b0c63d3c80beb2878e Mon Sep 17 00:00:00 2001 From: 18142669586 <1669783059@qq.com> Date: Tue, 28 May 2024 16:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E3=80=90=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E3=80=91=E5=8A=A0=E4=B8=8A=E9=98=B2=E6=8A=96=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/PDLiveApi.java | 2 +- .../adapter/AnchorUserMicInfoAdapter.java | 19 ++++---- .../presenter/LiveSwLinkMicPkPresenter.java | 48 ++++++++----------- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 13a2a4524..79932a5a6 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -216,7 +216,7 @@ public interface PDLiveApi { ); /** - * 关注主播 + * 关注主播··································································· * * @param liveuid * @return diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index 7304344a7..68d50d2f7 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -121,11 +121,12 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga); 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) { - UserBean tag = (UserBean) v.getTag(); - ViewClicksAntiShake.clicksAntiShake(mBtn, () -> { + ViewClicksAntiShake.clicksAntiShake(mBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (MicedUserManager.get().getMicUserList().size() < 3) { + if (mBtn.getTag() != null) { + UserBean tag = (UserBean) mBtn.getTag(); if (tag.getTypeMic() == TYPE_MIC_REQUEST) { applyMic(tag, 4, createSocketSendBean()); ToastUtil.show(mContext.getString(R.string.live_mic_request)); @@ -140,12 +141,14 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { applyMic(tag, 1, bean); 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 -> { if (v.getTag() != null) { API.get().createPDLiveApi(false) diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index b0aa3128c..8eab1626e 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -690,43 +690,33 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { mIsApplyDialogShow = false; 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 - public void onFailed(RTCErrorCode errorCode) { + public void onAttached(io.rong.imlib.model.Message message) { } @Override - public void onSuccess() { - final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8); - msg1.create(); + public void onSuccess(io.rong.imlib.model.Message message) { - 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); + Log.e("ry", "发送成功"); + if (SocketSwClient.mSocketHandler != null) { + SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + ""); + } + } - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { - @Override - public void onAttached(io.rong.imlib.model.Message message) { - - } - - @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()); - } - }); + @Override + public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { + Log.e("ry", "发送失敗" + u.getId()); } });