diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index eb7a526dd..bff0273c6 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -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()); } }