From 80d5bf30070e22373fc87e68082144b79598d992 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 11:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E6=92=AD=E7=AB=AF?= =?UTF-8?q?=E5=BC=80=E6=92=ADBanner=E6=B2=A1=E6=B4=BB=E5=8A=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/LiveRyAnchorViewHolder.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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()); } }