礼物墙-修复bug

This commit is contained in:
Martin 2024-07-18 18:28:15 +08:00
parent 1cde41f2d0
commit 08c46a7684
6 changed files with 103 additions and 34 deletions

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -1,23 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="120dp"
android:orientation="vertical"
android:layout_height="110dp">
android:paddingTop="10dp">
<ImageView
android:id="@+id/achieve_img"
android:layout_width="wrap_content"
android:layout_height="90dp"/>
android:layout_height="90dp"
android:layout_centerHorizontal="true" />
<ImageView
android:id="@+id/achieve_img_lock"
android:layout_width="wrap_content"
android:layout_height="90dp"
android:layout_centerHorizontal="true"
android:src="@mipmap/achieve_img_lock" />
<TextView
android:id="@+id/achieveName"
android:layout_width="wrap_content"
android:layout_height="26dp"
android:layout_below="@+id/achieve_img"
android:layout_centerHorizontal="true"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -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,21 +397,40 @@ 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));*/
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);
}
}
/**
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调
@ -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);

View File

@ -1349,9 +1349,32 @@ 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);
}*/
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"));
@ -1362,6 +1385,7 @@ public class SocketSwClient {
userBean.setUserNiceName(map.getString("uname"));
livePushSwViewHolder.setAnPkRtc(userBean);
}
}
break;
case 3://对方主播拒绝PK的回调
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);