调整排行榜点击正在直播的主播直接跳到直播间

This commit is contained in:
zlzw 2022-11-17 18:26:29 +08:00
parent d0a373123a
commit 324917672c

View File

@ -13,19 +13,23 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; 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.utils.WordUtil;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; 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.R;
import com.yunbao.main.activity.LoginActivity;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.adapter.MainListAdapter; import com.yunbao.main.adapter.MainListAdapter;
import com.yunbao.main.bean.ListBean; import com.yunbao.main.bean.ListBean;
@ -131,11 +140,38 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
mAdapter.updateItem(touid, isAttention); mAdapter.updateItem(touid, isAttention);
} }
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
@Override @Override
public void onItemClick(ListBean bean, int position) { public void onItemClick(ListBean bean, int position) {
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); RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
} }
}
public void setAppbarListener(OnAppbarListener appbarListener) { public void setAppbarListener(OnAppbarListener appbarListener) {
this.appbarListener = appbarListener; this.appbarListener = appbarListener;