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) {