From 08c46a76849662ecbe87e024fe1035c2704b1834 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Thu, 18 Jul 2024 18:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BC=E7=89=A9=E5=A2=99-=E4=BF=AE=E5=A4=8Db?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/GiftWallAchieveAdapter.java | 8 ++- .../dialog/GiftWallAchieveWearDialog.java | 4 ++ .../layout/view_gift_wall_achieve_item.xml | 20 ++++-- .../main/res/mipmap-mdpi/achieve_img_lock.png | Bin 0 -> 7759 bytes .../presenter/LiveLinkMicPkPresenter.java | 59 +++++++++++++----- .../yunbao/live/socket/SocketSwClient.java | 46 ++++++++++---- 6 files changed, 103 insertions(+), 34 deletions(-) create mode 100644 common/src/main/res/mipmap-mdpi/achieve_img_lock.png diff --git a/common/src/main/java/com/yunbao/common/adapter/GiftWallAchieveAdapter.java b/common/src/main/java/com/yunbao/common/adapter/GiftWallAchieveAdapter.java index 68a6779a4..0331ea3c5 100644 --- a/common/src/main/java/com/yunbao/common/adapter/GiftWallAchieveAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/GiftWallAchieveAdapter.java @@ -58,23 +58,27 @@ public class GiftWallAchieveAdapter extends RecyclerView.Adapter { private TextView achieveName; private ImageView achieveImg; + private ImageView achieveImgLock; + public GiftWallAchieveViewHolder(@NonNull View itemView) { super(itemView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if(onItemClickListener!=null){ + if (onItemClickListener != null) { onItemClickListener.onItemClick(getAdapterPosition()); } } }); achieveName = itemView.findViewById(R.id.achieveName); achieveImg = itemView.findViewById(R.id.achieve_img); + achieveImgLock = itemView.findViewById(R.id.achieve_img_lock); } public void showData(UserMedalListModel quantityModel) { achieveName.setText(quantityModel.getDressName()); - ImgLoader.display(mContext,quantityModel.getDisplaySrc(),achieveImg); + ImgLoader.display(mContext, quantityModel.getDisplaySrc(), achieveImg); + achieveImgLock.setVisibility(quantityModel.getDressStatus().equals("1") ? View.VISIBLE : View.GONE); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java index e86d86c7b..5db59225a 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java @@ -14,6 +14,7 @@ import com.stx.xhb.androidx.transformers.Transformer; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserMedalModel; import com.yunbao.common.custom.LiveGuardScalePageTransformer; import com.yunbao.common.glide.ImgLoader; @@ -105,6 +106,9 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { public void onSuccess(HttpCallbackModel data) { ToastUtil.show(data.getMsg()); if (data.getCode() == 0) { + UserBean u = CommonAppConfig.getInstance().getUserBean(); + u.setMedal_no_display_src(achieveWearModels.get(selectPosition).getDisplaySrc()); + CommonAppConfig.getInstance().setUserBean(u); if(userUseDressSuccess!=null){ userUseDressSuccess.onSuccess(); } diff --git a/common/src/main/res/layout/view_gift_wall_achieve_item.xml b/common/src/main/res/layout/view_gift_wall_achieve_item.xml index d71b3fa12..cb60b5eed 100644 --- a/common/src/main/res/layout/view_gift_wall_achieve_item.xml +++ b/common/src/main/res/layout/view_gift_wall_achieve_item.xml @@ -1,23 +1,33 @@ - + android:paddingTop="10dp"> + android:layout_height="90dp" + android:layout_centerHorizontal="true" /> + + - \ No newline at end of file + \ No newline at end of file diff --git a/common/src/main/res/mipmap-mdpi/achieve_img_lock.png b/common/src/main/res/mipmap-mdpi/achieve_img_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..d8135a84154d80cf02cf68acb27d243817526927 GIT binary patch literal 7759 zc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Xff5Th$V?dY5<%y~3A2vpFlFqEGBP~{kBm0)LUSP(;ORi$;B#0LZCqo&p}sIRk?4cW+Tv>_b5;L*4Ea-_I%DGqskh~`OJR~ z4L-?$k{yu~jK6Ggs!m+lKk1{OplEC|tlGRwc~A7!5lZ3V!=EaOS|ZTg=5jYVJYhaJ zS&haI$?n)&<`ba*=K&^?Lq4Sga=aLiL;-TE3h(;QceKj+m{WLuR`72ukthcTYS5t6 z{Rd1lqJ^JHvx z-xL*A!26A3zB$Gm@#lgXC9qPTIl3x1?(i+rqwYMV-=^O9`SY>0v&=r-cbBAs`z`~% UjK6P!2{8nzsQ#$rp=t2{0EBV_I{*Lx literal 0 HcmV?d00001 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java index 6b502f695..ccd32ba92 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java @@ -28,6 +28,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.manager.RandomPkManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.StringUtil; @@ -44,6 +45,7 @@ import com.yunbao.live.momo.GenerateTestUserSig; import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketLinkMicPkUtil; import com.yunbao.live.socket.SocketSendBean; +import com.yunbao.live.socket.SocketSwClient; import com.yunbao.live.views.LiveLinkMicPkViewHolder; import com.yunbao.live.views.LivePushTxViewHolder; @@ -53,10 +55,16 @@ import java.util.List; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.tencent.trtc.TRTCCloudDef.TRTC_APP_SCENE_LIVE; +import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.live.activity.LiveAnchorActivity.isDRPK; import static com.yunbao.live.views.AbsLivePushViewHolder.mPreView; import static com.yunbao.live.views.LivePushTxViewHolder.dr_pk_view; +import io.rong.imlib.IRongCallback; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; +import io.rong.message.TextMessage; + /** * Created by cxf on 2018/11/16. * 主播与主播PK逻辑 @@ -389,20 +397,39 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener { } //接受PK回调 - private void pkAccept() { - /*mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud(); - mTRTCParams1 = new TRTCCloudDef.TRTCParams(); - mTRTCParams1.sdkAppId = GenerateTestUserSig.SDKAPPID; - mTRTCParams1.userId = CommonAppConfig.getInstance().getUid() + "pk"; - mTRTCParams1.roomId = Integer.parseInt(mApplyUid); - mTRTCParams1.userSig = GenerateTestUserSig.genTestUserSig(mTRTCParams1.userId); - mTRTCParams1.role = TRTCCloudDef.TRTCRoleAudience; - mTRTCCloud1.enterRoom(mTRTCParams1, TRTC_APP_SCENE_LIVE); - mTRTCCloud1.startRemoteView(mApplyUid, LivePushTxViewHolder.mPreView1); - mTRTCCloud1.setListener(new TRTCCloudImplListener(mContext));*/ - LivePushTxViewHolder.btn_close.setVisibility(View.VISIBLE); - SocketLinkMicPkUtil.linkMicPkAccept(mSocketClient, mApplyUid, mApplyUrl, mApplyNmae); - onLinkMicPkStart(mApplyUid, mApplyUrl, mApplyNmae); + private void pkAccept(String uid) { + if(RandomPkManager.getInstance().getStatus()==RandomPkManager.PK_STATUS_START){ + final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8); + msg1.create(); + + 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(uid, conversationType, messageContent); + + 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", "发送失敗" + mApplyUid); + } + }); + }else{ + LivePushTxViewHolder.btn_close.setVisibility(View.VISIBLE); + SocketLinkMicPkUtil.linkMicPkAccept(mSocketClient, mApplyUid, mApplyUrl, mApplyNmae); + onLinkMicPkStart(mApplyUid, mApplyUrl, mApplyNmae); + } } /** @@ -423,7 +450,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener { showApplyDialog(u); } } else { - pkAccept(); + pkAccept(u.getId()); } } @@ -690,7 +717,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener { // public void onSuccess(int code, String msg, String[] info) { // if (code == 0) { - pkAccept(); + pkAccept(u.getId()); } else { if (mPkWaitCount < 0) { SocketLinkMicPkUtil.linkMicPkNotResponse(mSocketClient, mApplyUid); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java index 5da4fae24..cc71f3842 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -1349,18 +1349,42 @@ public class SocketSwClient { break; case 2://收到对方主播PK回调 L.eSw("收到对方主播PK回调"); - /*if("1".equals(map.getString("random_pk"))){ + if(RandomPkManager.getInstance().getStatus()==RandomPkManager.PK_STATUS_START){ + final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8); + msg1.create(); + 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(map.getString("uid"), conversationType, messageContent); - }*/ - RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START); - mListener.onLinkMicToPk(map.getString("uid"), map.getString("uhead"), map.getString("uhead")); - mListener.onLinkMicPkStart(map.getString("uid"), map.getString("uhead"), map.getString("uname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); - if (livePushSwViewHolder != null) { - UserBean userBean = new UserBean(); - userBean.setId(map.getString("uid")); - userBean.setAvatar(map.getString("uhead")); - userBean.setUserNiceName(map.getString("uname")); - livePushSwViewHolder.setAnPkRtc(userBean); + 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) { + } + }); + }else{ + RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START); + mListener.onLinkMicToPk(map.getString("uid"), map.getString("uhead"), map.getString("uhead")); + mListener.onLinkMicPkStart(map.getString("uid"), map.getString("uhead"), map.getString("uname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); + if (livePushSwViewHolder != null) { + UserBean userBean = new UserBean(); + userBean.setId(map.getString("uid")); + userBean.setAvatar(map.getString("uhead")); + userBean.setUserNiceName(map.getString("uname")); + livePushSwViewHolder.setAnPkRtc(userBean); + } } break; case 3://对方主播拒绝PK的回调