Merge remote-tracking branch 'origin/dev_680_礼物展馆' into dev_680_礼物展馆

This commit is contained in:
zlzw 2024-07-19 09:27:12 +08:00
commit ba8090eec7
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,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);

View File

@ -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的回调