From c99d139940ade1f8ef8a0ef43f2a1771859fb79d Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 18 Nov 2022 14:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E6=A6=9C=E9=9C=80=E8=A6=81=E7=82=B9=E5=87=BB=E4=B8=A4?= =?UTF-8?q?=E6=AC=A1=E6=89=8D=E8=83=BD=E5=85=B3=E6=B3=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E6=A6=9Ctop3=E7=82=B9=E5=87=BB=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E8=BF=9B=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/main/adapter/MainListAdapter.java | 9 ++-- .../views/AbsMainListChildViewHolder.java | 41 +++++++++++++++---- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java index 7c77761ef..e222d942c 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java @@ -27,7 +27,6 @@ import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.WordUtil; -import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; import com.yunbao.main.bean.ListBean; @@ -61,7 +60,7 @@ public class MainListAdapter extends RefreshAdapter { mTopList = new ArrayList<>(); mFollow = (WordUtil.getString(R.string.follow)); mFollowing = WordUtil.getString(R.string.following); - mItemClickListener = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> { + mItemClickListener = v -> { Object tag = v.getTag(); if (tag != null && mOnItemClickListener != null) { ListBean model = (ListBean) tag; @@ -72,8 +71,8 @@ public class MainListAdapter extends RefreshAdapter { } } - }); - mFollowClickListener2 = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> { + }; + mFollowClickListener2 = v -> { if (!canClick()) { return; } @@ -90,7 +89,7 @@ public class MainListAdapter extends RefreshAdapter { } }); } - }); + }; } diff --git a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java index 3fb10adc9..c93587f1b 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -36,12 +36,10 @@ import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; -import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; -import com.yunbao.main.activity.LoginActivity; import com.yunbao.main.activity.MainActivity; import com.yunbao.main.adapter.MainListAdapter; import com.yunbao.main.bean.ListBean; @@ -140,10 +138,12 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple mAdapter.updateItem(touid, isAttention); } } + private LiveRoomCheckLivePresenter mCheckLivePresenter; + @Override public void onItemClick(ListBean bean, int position) { - if(bean.getIslive()==1){ + if (bean.getIslive() == 1) { LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -168,7 +168,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple } } }); - }else { + } else { RouteUtil.forwardUserHome(mContext, bean.getUid(), 0); } } @@ -362,13 +362,38 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple }); }); getItem(position, mItem1, mItem2, mItem3).setOnClickListener(v -> { - ViewClicksAntiShake.clicksAntiShake(v, () -> { - if (bean.isHide()) { - ToastUtil.show(R.string.can_not_go); + if (bean.isHide()) { + ToastUtil.show(R.string.can_not_go); + } else { + if (bean.getIslive() == 1) { + LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + + if (mCheckLivePresenter == null) { + mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + @Override + public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { + if (liveBean == null) { + return; + } + LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); + NoviceInstructorManager.get(mContext).setFrist(false); + } + }); + } + mCheckLivePresenter.checkLive(liveBean); + } else { + MainActivity.forward(mContext, false); + } + } + }); } else { RouteUtil.forwardUserHome(mContext, bean.getUid(), 0); } - }); + } }); }