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); } - }); + } }); }