From cb3925378547dfc4007f17d438b930bf3160e4c9 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 10:57:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E6=92=AD=E7=AB=AF?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BF=83=E6=84=BF=E5=8D=95=E5=88=B7=E6=96=B0?= =?UTF-8?q?banner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/dialog/LiveNewWishListDialogFragment.java | 7 +++++-- .../java/com/yunbao/live/event/LiveAudienceEvent.java | 3 ++- .../com/yunbao/live/views/LiveRyAnchorViewHolder.java | 11 +++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java index 7984e4079..ad8070a53 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java @@ -1,5 +1,7 @@ package com.yunbao.live.dialog; +import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE; + import android.os.Bundle; import android.util.Log; import android.view.Gravity; @@ -8,7 +10,6 @@ import android.view.Window; import android.view.WindowManager; import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -18,14 +19,15 @@ import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.adapter.LiveNewWishListAdapter; -import com.yunbao.live.adapter.LiveWishListAdapter; import com.yunbao.live.bean.LiveWishlistBean; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; @@ -243,6 +245,7 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements mContext = null; LiveHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST); LiveHttpUtil.cancel(LiveHttpConsts.SET_WISH_LIST); + Bus.get().post(new LiveAudienceEvent().setType(WISH_LIST_UPDATE)); EventBus.getDefault().unregister(this); } } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 4094647cb..ae8558f29 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -172,7 +172,8 @@ public class LiveAudienceEvent extends BaseModel { FLOAT_SETTING(29, "悬浮窗设置"), VOICE_PRESS(30, "长按展示图片"), LUCKY_ANGEL(31, "幸运天使"), - WE_CHEAT(32, "整蛊") + WE_CHEAT(32, "整蛊"), + WISH_LIST_UPDATE(33, "心愿单更新推送") ; private int type; 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 bcad3b1dc..eb7a526dd 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -4,6 +4,8 @@ import static com.yunbao.live.activity.LiveActivity.mLiveUid; import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing; import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub; import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE; +import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST; +import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom; import android.content.Context; @@ -315,6 +317,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { .setCurrentAssistNum(msgModel.getCurrentAssistNum()); Log.i("测试", "更新星级任务=" + model); showStart(model); + } else if (event.getType() == WISH_LIST_UPDATE) { + initWishList(); } } @@ -391,6 +395,13 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { } public void addWishList(BannerBean bannerModel) { + for (int i = 0; i < mBannerList.size(); i++) { + if ("2".equals(mBannerList.get(i).getShow_type())) { + mBannerList.set(i, bannerModel); + updateBanner(mBannerList); + return; + } + } mBannerList.add(bannerModel); updateBanner(mBannerList); }