修复单人PK,弹出多个弹窗问题
This commit is contained in:
parent
807827564b
commit
c3ffb658c8
@ -25,6 +25,7 @@ import com.yunbao.common.manager.IMLoginManager;
|
|||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
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.common.views.weight.ViewClicksAntiShake;
|
||||||
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.live.activity.LiveSwAnchorActivity;
|
import com.yunbao.live.activity.LiveSwAnchorActivity;
|
||||||
@ -129,85 +130,54 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
mAvatar = itemView.findViewById(R.id.item_avatar);
|
mAvatar = itemView.findViewById(R.id.item_avatar);
|
||||||
mPkStatus = itemView.findViewById(R.id.item_pk);
|
mPkStatus = itemView.findViewById(R.id.item_pk);
|
||||||
mFollow = itemView.findViewById(R.id.item_follow);
|
mFollow = itemView.findViewById(R.id.item_follow);
|
||||||
mPkStatus.setOnClickListener(v -> {
|
ViewClicksAntiShake.clicksAntiShake(mPkStatus, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
@Override
|
||||||
if (bean.isPk()) {
|
public void onViewClicks() {
|
||||||
ToastUtil.show(mContext.getString(R.string.free_pk_user_pking));
|
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||||
return;
|
if (bean.isPk()) {
|
||||||
}
|
ToastUtil.show(mContext.getString(R.string.free_pk_user_pking));
|
||||||
if (freePkNum == 0 && mDrPkNum == -1) {
|
return;
|
||||||
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
}
|
||||||
return;
|
if (freePkNum == 0 && mDrPkNum == -1) {
|
||||||
}
|
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
||||||
//检查自己是不是在PK中
|
return;
|
||||||
LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() {
|
}
|
||||||
@Override
|
//检查自己是不是在PK中
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() {
|
||||||
if (code == 0 && info.length > 0) {
|
@Override
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if (obj != null) {
|
if (code == 0 && info.length > 0) {
|
||||||
if(mDrPkNum!=-1){
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
if (obj != null) {
|
||||||
@Override
|
if(mDrPkNum!=-1){
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
|
||||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
|
||||||
//非0认为未开通连麦权限
|
|
||||||
if (code != 0) {
|
|
||||||
if (mDrPkNum <= 0) {
|
|
||||||
if (WordUtil.isNewZh()) {
|
|
||||||
ToastUtil.show("多人次數已用完");
|
|
||||||
} else {
|
|
||||||
ToastUtil.show("Multiple times have been used up");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
yaoqing.put(bean.getId(), bean.getId());
|
|
||||||
if (yaoqing.size() < 5) {
|
|
||||||
if(mContext instanceof LiveSwAnchorActivity){
|
|
||||||
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
|
||||||
}else{
|
|
||||||
((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 {
|
|
||||||
if (WordUtil.isNewZh()) {
|
|
||||||
ToastUtil.show("請先關閉語音連麥");
|
|
||||||
} else {
|
|
||||||
ToastUtil.show("Please disable the voice connection first");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请
|
|
||||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||||
//非0认为未开通连麦权限
|
//非0认为未开通连麦权限
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (mDrPkNum == -1) {
|
if (mDrPkNum <= 0) {
|
||||||
if (WordUtil.isNewZh()) {
|
if (WordUtil.isNewZh()) {
|
||||||
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
ToastUtil.show("多人次數已用完");
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("invite " + bean.getUserNiceName() + " successful");
|
ToastUtil.show("Multiple times have been used up");
|
||||||
}
|
|
||||||
mOnItemClickListener.onItemClick(bean, -1);
|
|
||||||
if(mContext instanceof LiveSwAnchorActivity){
|
|
||||||
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
|
||||||
false);
|
|
||||||
}else{
|
|
||||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
|
||||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
yaoqing.put(bean.getId(), bean.getId());
|
||||||
|
if (yaoqing.size() < 5) {
|
||||||
|
if(mContext instanceof LiveSwAnchorActivity){
|
||||||
|
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||||
|
}else{
|
||||||
|
((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()) {
|
||||||
ToastUtil.show("請先關閉語音連麥");
|
ToastUtil.show("請先關閉語音連麥");
|
||||||
@ -218,19 +188,51 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
if (WordUtil.isNewZh()) {
|
if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请
|
||||||
ToastUtil.show("請先關閉PK");
|
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||||
} else {
|
@Override
|
||||||
ToastUtil.show("Please disable the PK");
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||||
|
//非0认为未开通连麦权限
|
||||||
|
if (code != 0) {
|
||||||
|
if (mDrPkNum == -1) {
|
||||||
|
if (WordUtil.isNewZh()) {
|
||||||
|
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("invite " + bean.getUserNiceName() + " successful");
|
||||||
|
}
|
||||||
|
mOnItemClickListener.onItemClick(bean, -1);
|
||||||
|
if(mContext instanceof LiveSwAnchorActivity){
|
||||||
|
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||||
|
false);
|
||||||
|
}else{
|
||||||
|
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||||
|
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (WordUtil.isNewZh()) {
|
||||||
|
ToastUtil.show("請先關閉語音連麥");
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("Please disable the voice connection first");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
if (WordUtil.isNewZh()) {
|
||||||
|
ToastUtil.show("請先關閉PK");
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("Please disable the PK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
mFollow.setOnClickListener(v -> {
|
mFollow.setOnClickListener(v -> {
|
||||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||||
|
@ -59,7 +59,6 @@ public abstract class AbsLinkMicPkPresenter {
|
|||||||
if (u.isRandomPk()) {
|
if (u.isRandomPk()) {
|
||||||
showPkDialogTmp(u);
|
showPkDialogTmp(u);
|
||||||
} else {
|
} else {
|
||||||
mIsApplyDialogShow = true;
|
|
||||||
showApplyDialogTmp(u);
|
showApplyDialogTmp(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
@Override
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
Log.e("tx", "aaa" + errorCode.toString());
|
Log.e("tx", "aaa" + errorCode.toString());
|
||||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -801,7 +800,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
@Override
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
Log.e("tx", "aaa" + errorCode.toString());
|
Log.e("tx", "aaa" + errorCode.toString());
|
||||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -829,7 +827,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
@Override
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
Log.e("tx", "aaa" + errorCode.toString());
|
Log.e("tx", "aaa" + errorCode.toString());
|
||||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user