调整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 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 +
'}';
}

View File

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