修复Banner连点多开问题

This commit is contained in:
zlzw 2022-10-28 16:03:12 +08:00
parent f1554f8201
commit fd687ab2d5

View File

@ -1112,7 +1112,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.setOnBannerClickListener(new OnBannerClickListener() { .setOnBannerClickListener(new OnBannerClickListener() {
@Override @Override
public void onBannerClick(List datas, int p) { public void onBannerClick(List datas, int p) {
showLoadingDialog(); if (showLoadingDialog()) {
return;
}
if (mBannerList2 != null) { if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) { if (p >= 0 && p < mBannerList2.size()) {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
@ -1169,7 +1171,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.setOnBannerClickListener(new OnBannerClickListener() { .setOnBannerClickListener(new OnBannerClickListener() {
@Override @Override
public void onBannerClick(List datas, int p) { public void onBannerClick(List datas, int p) {
showLoadingDialog(); if (showLoadingDialog()) {
return;
}
if (mBannerList2 != null) { if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) { if (p >= 0 && p < mBannerList2.size()) {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
@ -1235,10 +1239,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
reloadIM(); reloadIM();
} }
private void showLoadingDialog() { Dialog loadingDialog = null;
final Dialog loadingDialog = DialogUitl.loadingDialog(mContext, WordUtil.getString(R.string.login_wait));
private boolean showLoadingDialog() {
if (loadingDialog != null && loadingDialog.isShowing()) {
return true;
}
loadingDialog = DialogUitl.loadingDialog(mContext, WordUtil.getString(R.string.login_wait));
loadingDialog.show(); loadingDialog.show();
new Handler(Looper.getMainLooper()).postDelayed(loadingDialog::dismiss, 1000); new Handler(Looper.getMainLooper()).postDelayed(() -> {
if (loadingDialog != null) {
loadingDialog.dismiss();
}
loadingDialog = null;
}, 1000);
return false;
} }
public void setLiveUid(String liveUid) { public void setLiveUid(String liveUid) {
@ -3019,7 +3034,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
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());
BannerBean bean = mBannerList4.get(p); BannerBean bean = mBannerList4.get(p);
showLoadingDialog(); if (showLoadingDialog()) {
return;
}
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗 if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setActivity(true) .setActivity(true)