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();