修复主播端开播Banner没活动问题

This commit is contained in:
zlzw 2022-11-08 11:03:06 +08:00
parent cb39253785
commit 80d5bf3007

View File

@ -21,6 +21,7 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.ms.banner.Banner;
import com.ms.banner.BannerConfig;
@ -406,6 +407,30 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
updateBanner(mBannerList);
}
public void setLiveUid(String liveUid) {
LiveHttpUtil.geteEvent(liveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
for (String s : info) {
JSONObject obj = JSONObject.parseObject(s);
if (obj.getString("is_hidden").equals("0")) {
BannerBean bannerBean = new BannerBean();
bannerBean.setImageUrl(obj.getString("img"));
bannerBean.setLink(obj.getString("link"));
bannerBean.setShow_type(obj.getString("show_type"));
mBannerList.add(bannerBean);
}
}
if (mBannerList.size() > 0) {
if (mBanner.isStart()) {
mBanner.update(mBannerList);
}
}
}
}
});
}
public void showBanner() {
if (mBannerList != null && mBanner != null) {
@ -541,5 +566,6 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
showBanner();
initStarData();
initWishList();
setLiveUid(mLiveBean.getUid());
}
}