diff --git a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java index 4e255eded..24633465c 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java @@ -25,6 +25,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveSwAnchorActivity; @@ -129,85 +130,54 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { mAvatar = itemView.findViewById(R.id.item_avatar); mPkStatus = itemView.findViewById(R.id.item_pk); mFollow = itemView.findViewById(R.id.item_follow); - mPkStatus.setOnClickListener(v -> { - RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); - if (bean.isPk()) { - ToastUtil.show(mContext.getString(R.string.free_pk_user_pking)); - return; - } - if (freePkNum == 0 && mDrPkNum == -1) { - ToastUtil.show(mContext.getString(R.string.free_pk_num_null)); - return; - } - //检查自己是不是在PK中 - LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - if (obj != null) { - if(mDrPkNum!=-1){ - LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { - @Override - 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,可以发起邀请 + ViewClicksAntiShake.clicksAntiShake(mPkStatus, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); + if (bean.isPk()) { + ToastUtil.show(mContext.getString(R.string.free_pk_user_pking)); + return; + } + if (freePkNum == 0 && mDrPkNum == -1) { + ToastUtil.show(mContext.getString(R.string.free_pk_num_null)); + return; + } + //检查自己是不是在PK中 + LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + if (obj != null) { + if(mDrPkNum!=-1){ LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { @Override 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 (mDrPkNum <= 0) { if (WordUtil.isNewZh()) { - ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); + ToastUtil.show("多人次數已用完"); } 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() - ); + 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("請先關閉語音連麥"); @@ -218,19 +188,51 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { } }); }else{ - if (WordUtil.isNewZh()) { - ToastUtil.show("請先關閉PK"); - } else { - ToastUtil.show("Please disable the PK"); + if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 + LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { + @Override + 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 -> { RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); diff --git a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java index f5785d45e..110acedd9 100644 --- a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java @@ -59,7 +59,6 @@ public abstract class AbsLinkMicPkPresenter { if (u.isRandomPk()) { showPkDialogTmp(u); } else { - mIsApplyDialogShow = true; showApplyDialogTmp(u); } } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index ee7cf0d6e..5504ffff0 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -767,7 +767,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); @@ -801,7 +800,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); } @@ -829,7 +827,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); }