From 9c629937dadea47c9dc432e916eedf13a80de0c1 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 26 Oct 2022 17:26:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4Banner=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/BannerBean.java | 10 +++++ .../yunbao/live/views/LiveRoomViewHolder.java | 43 ++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/BannerBean.java b/common/src/main/java/com/yunbao/common/bean/BannerBean.java index 07c941c8c..e09c9cc55 100644 --- a/common/src/main/java/com/yunbao/common/bean/BannerBean.java +++ b/common/src/main/java/com/yunbao/common/bean/BannerBean.java @@ -14,6 +14,7 @@ public class BannerBean { private String show_type; private String mIntoUrl; private int type; + private String name; private StarChallengeStatusModel model; @@ -81,6 +82,14 @@ public class BannerBean { public void setType(int type) { this.type = type; } + @JSONField(name = "name") + public String getName() { + return name; + } + @JSONField(name = "name") + public void setName(String name) { + this.name = name; + } @Override public String toString() { @@ -91,6 +100,7 @@ public class BannerBean { ", show_type='" + show_type + '\'' + ", mIntoUrl='" + mIntoUrl + '\'' + ", type=" + type + + ", name='" + name + '\'' + ", model=" + model + '}'; } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 46b0154f2..535f6c89d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -69,6 +69,7 @@ import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; @@ -1288,6 +1289,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mBannerList4.clear(); for (LiveRoomActivityBanner datum : data) { BannerBean bean = new BannerBean(); + bean.setName(datum.getName()); bean.setLink(datum.getLink()); bean.setImageUrl(datum.getImg()); bean.setShow_type(datum.getType()); @@ -2989,10 +2991,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .setDelayTime(3000) .setBannerStyle(BannerConfig.NOT_INDICATOR) .setOnBannerClickListener(new OnBannerClickListener() { + Dialog loadingDialog; + @Override public void onBannerClick(List datas, int p) { Log.i("debug", "onBannerClick: " + mBannerList4.get(p).toString()); - String url = mBannerList4.get(p).getLink(); + BannerBean bean = mBannerList4.get(p); + loadingDialog = DialogUitl.loadingDialog(mContext); + loadingDialog.show(); + if ("幸运天使".equals(bean.getName())) { + openWebDialog(bean.getLink()); + } else if ("新人特惠".equals(bean.getName())) { + showNewPeopleInfo(); + }else{ + loadingDialog.dismiss(); + } + } + + public void showNewPeopleInfo() { + API.get().pdLiveApi(mContext) + .getNewPeopleInfo() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(stringResponseModel -> { + NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo(); + if (peopleInfo.getIsShow()) { + String newPeopleUrl; + if (peopleInfo.getLink().startsWith("http")) { + newPeopleUrl = peopleInfo.getLink() + "?"; + } else { + newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink(); + } + openWebDialog(newPeopleUrl); + } + }, Throwable::printStackTrace).isDisposed(); + } + + private void openWebDialog(String url) { if (!url.startsWith("http")) { url = CommonAppConfig.HOST + url; } @@ -3002,13 +3037,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis url += "?"; } url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + + CommonAppConfig.getInstance().getToken()+"&anchorUid="+mLiveUid; Log.i("tag", url); Bundle bundle1 = new Bundle(); bundle1.putString("url", url); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); liveHDDialogFragment.setArguments(bundle1); liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + if (loadingDialog != null && loadingDialog.isShowing()) { + loadingDialog.dismiss(); + loadingDialog = null; + } } }) .start();