fix:直播间侧边推荐Banner多次点击可能导致重复进入直播间问题

This commit is contained in:
zlzw 2022-10-19 16:36:09 +08:00
parent 99d32c03b2
commit 28137615df

View File

@ -1,6 +1,7 @@
package com.yunbao.live.views;
import android.app.Activity;
import android.app.Dialog;
import android.view.View;
import androidx.annotation.NonNull;
@ -11,6 +12,7 @@ import com.ms.banner.Banner;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.SlideInBannerViewHolder;
import com.yunbao.live.R;
@ -26,11 +28,13 @@ import java.util.Map;
public class SidebarViewHoler extends RecyclerView.ViewHolder {
//侧边栏轮播
private Banner mBanner;
private Dialog mShowLoadingDialog;
public SidebarViewHoler(@NonNull View itemView) {
super(itemView);
//侧边栏轮播
mBanner = itemView.findViewById(R.id.banner);
mShowLoadingDialog = DialogUitl.loadingDialog(itemView.getContext());
}
@ -52,6 +56,7 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
if (p >= 0 && p < data.size()) {
SlideInfoModel bean = data.get(p);
if (bean != null) {
showLoadingDialog();
String link = bean.getSlideUrl();
if (link.contains("http")) {
WebViewActivity.forward(itemView.getContext(), link, true);
@ -76,6 +81,7 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) {
mShowLoadingDialog.dismiss();
return;
}
Map<String, String> map = null;
@ -84,15 +90,23 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
map.put("OPEN", "NEWUSER");
}
LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk);
mShowLoadingDialog.dismiss();
((Activity) itemView.getContext()).finish();
});
mCheckLivePresenter.checkLive(liveBean);
} else {
mShowLoadingDialog.dismiss();
RouteUtil.forwardUserHome(itemView.getContext(), liveId, 0);
((Activity) itemView.getContext()).finish();
}
}
});
}
/**
* Banner双击可能会导致进入两次直播间点击Banner后需要展示加载中动画
*/
private void showLoadingDialog(){
mShowLoadingDialog.show();
}
}