From 324917672c2470e0fe02fa22b414559bef47dd12 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 17 Nov 2022 18:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8E=92=E8=A1=8C=E6=A6=9C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=AD=A3=E5=9C=A8=E7=9B=B4=E6=92=AD=E7=9A=84?= =?UTF-8?q?=E4=B8=BB=E6=92=AD=E7=9B=B4=E6=8E=A5=E8=B7=B3=E5=88=B0=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/AbsMainListChildViewHolder.java | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) 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 6835d3247..3fb10adc9 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -13,19 +13,23 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import com.alibaba.fastjson.JSON; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; +import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; @@ -33,7 +37,12 @@ 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; @@ -131,10 +140,37 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple mAdapter.updateItem(touid, isAttention); } } - + private LiveRoomCheckLivePresenter mCheckLivePresenter; @Override public void onItemClick(ListBean bean, int position) { - RouteUtil.forwardUserHome(mContext, bean.getUid(), 0); + 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); + } } public void setAppbarListener(OnAppbarListener appbarListener) {