多人pk邀请人数限制

This commit is contained in:
18401019693 2024-01-20 13:59:27 +08:00
parent e185eb8612
commit f770370be0
5 changed files with 66 additions and 18 deletions

View File

@ -5,7 +5,7 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 33, targetSdkVersion : 33,
versionCode : 462, versionCode : 462,
versionName : "6.6.3" versionName : "6.6.4"
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
@ -21,10 +21,10 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false 0 1 2 3 samsung包 // true表示谷歌支付 false 0 1 2 3 samsung包
isGooglePlay : 3, isGooglePlay : 0,
// //
isUploadLog : true, isUploadLog : true,
// //
isPluginModel : false, isPluginModel : true,
] ]
} }

View File

@ -1285,6 +1285,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
*/ */
public void linkDrMicAnchorApply(String pkUid, String stream) { public void linkDrMicAnchorApply(String pkUid, String stream) {
linkDrMicAnchorApply(pkUid, stream, SOCKET_LIVE_DRPK); linkDrMicAnchorApply(pkUid, stream, SOCKET_LIVE_DRPK);
if (mLiveAnchorViewHolder != null) {
mLiveAnchorViewHolder.setYaoqing(pkUid);
}
} }
/** /**

View File

@ -15,15 +15,17 @@ import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RandomPkUserBean;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.common.http.LiveHttpUtil;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** /**
* 单人PK/多人PK邀请的对话框适配器 * 单人PK/多人PK邀请的对话框适配器
@ -86,7 +88,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
} }
public void setData(RandomPkUserBean bean, int position) { public void setData(RandomPkUserBean bean, int position) {
if (!WordUtil.isNewZh() && itemView.findViewById(R.id.text1)!=null) { if (!WordUtil.isNewZh() && itemView.findViewById(R.id.text1) != null) {
((TextView) itemView.findViewById(R.id.text1)).setText("number"); ((TextView) itemView.findViewById(R.id.text1)).setText("number");
((TextView) itemView.findViewById(R.id.text2)).setText("user"); ((TextView) itemView.findViewById(R.id.text2)).setText("user");
((TextView) itemView.findViewById(R.id.text3)).setText("status"); ((TextView) itemView.findViewById(R.id.text3)).setText("status");
@ -96,6 +98,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
} }
} }
private Map<String, String> yaoqing = new HashMap<>();
public class ItemViewHolder extends HeadViewHolder { public class ItemViewHolder extends HeadViewHolder {
private TextView mNum; private TextView mNum;
@ -152,7 +155,15 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
} }
return; return;
} }
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId()); yaoqing.put(bean.getId(), bean.getId());
if (yaoqing.size() < 5) {
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
} else {
ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people");
}
if (freePkRecyclerListener != null) {
freePkRecyclerListener.onClose();
}
} else { } else {
if (WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
@ -183,7 +194,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
} }
}); });
}); });
@ -229,4 +240,15 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
} }
} }
} }
private FreePkRecyclerListener freePkRecyclerListener;
public FreePkRecyclerAdapter setFreePkRecyclerListener(FreePkRecyclerListener freePkRecyclerListener) {
this.freePkRecyclerListener = freePkRecyclerListener;
return this;
}
public interface FreePkRecyclerListener {
void onClose();
}
} }

View File

@ -152,6 +152,12 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
mRecyclerView.setRefreshEnable(false); mRecyclerView.setRefreshEnable(false);
mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty); mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty);
adapter.setDrPkNum(mDrPkNum); adapter.setDrPkNum(mDrPkNum);
adapter.setFreePkRecyclerListener(new FreePkRecyclerAdapter.FreePkRecyclerListener() {
@Override
public void onClose() {
dismiss();
}
});
adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() { adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() {
@Override @Override
public void onItemClick(RandomPkUserBean bean, int position) { public void onItemClick(RandomPkUserBean bean, int position) {

View File

@ -35,6 +35,7 @@ import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
@ -47,13 +48,14 @@ import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.bean.WishlistModel; import com.yunbao.live.bean.WishlistModel;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.http.LiveHttpUtil;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by cxf on 2018/10/9. * Created by cxf on 2018/10/9.
@ -88,6 +90,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
super(context, parentView); super(context, parentView);
} }
public long getmAnchorLiveTime() { public long getmAnchorLiveTime() {
return mAnchorLiveTime; return mAnchorLiveTime;
} }
@ -159,17 +162,24 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
} }
}); });
btn_start_dr_pk_view.setVisibility(View.GONE); btn_start_dr_pk_view.setVisibility(View.GONE);
yaoqing.clear();
} }
}); });
btn_dr.setOnClickListener(new View.OnClickListener() { btn_dr.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (PKing == false) {
((LiveRyAnchorActivity) mContext).openLinkMicAnchorWindow(true); if (yaoqing.size() < 3) {
if (PKing == false) {
((LiveRyAnchorActivity) mContext).openLinkMicAnchorWindow(true);
} else {
ToastUtil.show(WordUtil.isNewZh() ? "您已在PK中" : "You are already in the PK");
}
} else { } else {
ToastUtil.show(WordUtil.isNewZh()?"您已在PK中":"You are already in the PK"); ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people");
} }
} }
}); });
findViewById(R.id.btn_link_mic).setOnClickListener(this); findViewById(R.id.btn_link_mic).setOnClickListener(this);
@ -178,6 +188,12 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
mLiveRoomHandler = new LiveRoomHandler(); mLiveRoomHandler = new LiveRoomHandler();
} }
private Map<String, String> yaoqing = new HashMap<>();
public void setYaoqing(String numinda) {
yaoqing.put(numinda, numinda);
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!canClick()) { if (!canClick()) {
@ -349,7 +365,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
@Override @Override
public void onError(String error) { public void onError(String error) {
Log.e("PortraitLiveManager", error); Log.e("PortraitLiveManager", error);
ToastUtil.show( mContext.getString(R.string.net_error)); ToastUtil.show(mContext.getString(R.string.net_error));
} }
}); });
} }
@ -477,7 +493,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
.append("&uid=") .append("&uid=")
.append(userInfo.getId()) .append(userInfo.getId())
.append("&k=") .append("&k=")
.append(System.currentTimeMillis()) .append("&isZh=") .append(System.currentTimeMillis()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} else { } else {
type = bean.getShow_type(); type = bean.getShow_type();
@ -489,11 +505,11 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
.append("&anchorUid=") .append("&anchorUid=")
.append(mLiveUid) .append(mLiveUid)
.append("&t=") .append("&t=")
.append(System.currentTimeMillis()) .append("&isZh=") .append(System.currentTimeMillis()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} }
if (TextUtils.equals(type, "1")) { if (TextUtils.equals(type, "1")) {
ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false,0); ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 0);
} else { } else {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString()); bundle.putString("url", htmlUrl.toString());
@ -535,7 +551,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
.append("&uid=") .append("&uid=")
.append(userInfo.getId()) .append(userInfo.getId())
.append("&k=") .append("&k=")
.append(System.currentTimeMillis()) .append("&isZh=") .append(System.currentTimeMillis()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} else { } else {
type = bean.getShow_type(); type = bean.getShow_type();
@ -550,11 +566,11 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
.append(mLiveUid) .append(mLiveUid)
.append("&t=") .append("&t=")
.append(System.currentTimeMillis()) .append(System.currentTimeMillis())
.append("&g=Appapi&m=Wish&a=index") .append("&isZh=") .append("&g=Appapi&m=Wish&a=index").append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0); .append(WordUtil.isNewZh() ? "1" : 0);
} }
if (TextUtils.equals(type, "1")) { if (TextUtils.equals(type, "1")) {
ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false,0); ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 0);
} else { } else {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString()); bundle.putString("url", htmlUrl.toString());