调整Banner点击事件

This commit is contained in:
zlzw 2022-10-26 17:26:26 +08:00
parent 38d2e0df57
commit 9c629937da
2 changed files with 51 additions and 2 deletions

View File

@ -14,6 +14,7 @@ public class BannerBean {
private String show_type; private String show_type;
private String mIntoUrl; private String mIntoUrl;
private int type; private int type;
private String name;
private StarChallengeStatusModel model; private StarChallengeStatusModel model;
@ -81,6 +82,14 @@ public class BannerBean {
public void setType(int type) { public void setType(int type) {
this.type = type; this.type = type;
} }
@JSONField(name = "name")
public String getName() {
return name;
}
@JSONField(name = "name")
public void setName(String name) {
this.name = name;
}
@Override @Override
public String toString() { public String toString() {
@ -91,6 +100,7 @@ public class BannerBean {
", show_type='" + show_type + '\'' + ", show_type='" + show_type + '\'' +
", mIntoUrl='" + mIntoUrl + '\'' + ", mIntoUrl='" + mIntoUrl + '\'' +
", type=" + type + ", type=" + type +
", name='" + name + '\'' +
", model=" + model + ", model=" + model +
'}'; '}';
} }

View File

@ -69,6 +69,7 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -1288,6 +1289,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mBannerList4.clear(); mBannerList4.clear();
for (LiveRoomActivityBanner datum : data) { for (LiveRoomActivityBanner datum : data) {
BannerBean bean = new BannerBean(); BannerBean bean = new BannerBean();
bean.setName(datum.getName());
bean.setLink(datum.getLink()); bean.setLink(datum.getLink());
bean.setImageUrl(datum.getImg()); bean.setImageUrl(datum.getImg());
bean.setShow_type(datum.getType()); bean.setShow_type(datum.getType());
@ -2989,10 +2991,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.setDelayTime(3000) .setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR) .setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() { .setOnBannerClickListener(new OnBannerClickListener() {
Dialog loadingDialog;
@Override @Override
public void onBannerClick(List datas, int p) { public void onBannerClick(List datas, int p) {
Log.i("debug", "onBannerClick: " + mBannerList4.get(p).toString()); 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")) { if (!url.startsWith("http")) {
url = CommonAppConfig.HOST + url; url = CommonAppConfig.HOST + url;
} }
@ -3002,13 +3037,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
url += "?"; url += "?";
} }
url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken(); + CommonAppConfig.getInstance().getToken()+"&anchorUid="+mLiveUid;
Log.i("tag", url); Log.i("tag", url);
Bundle bundle1 = new Bundle(); Bundle bundle1 = new Bundle();
bundle1.putString("url", url); bundle1.putString("url", url);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle1); liveHDDialogFragment.setArguments(bundle1);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
if (loadingDialog != null && loadingDialog.isShowing()) {
loadingDialog.dismiss();
loadingDialog = null;
}
} }
}) })
.start(); .start();