优化主播端更新心愿单刷新banner

This commit is contained in:
zlzw 2022-11-08 10:57:06 +08:00
parent 3ec3350c97
commit cb39253785
3 changed files with 18 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);
}