fix:修复Banner重复点击会进入两次直播间的问题

This commit is contained in:
zlzw 2022-10-14 10:35:24 +08:00
parent 9503f4a6c7
commit fd038da6d7

View File

@ -1,6 +1,7 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Outline; import android.graphics.Outline;
import android.text.TextUtils; import android.text.TextUtils;
@ -31,6 +32,7 @@ import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomViewHolder; import com.yunbao.common.views.CustomViewHolder;
@ -82,6 +84,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
private List<LiveBean> new_data; private List<LiveBean> new_data;
private boolean isHave = false; private boolean isHave = false;
private Map<String, String> gotoRoomKey = new HashMap<>(); private Map<String, String> gotoRoomKey = new HashMap<>();
private Dialog mShowLoadingDialog;
public MainHomeLiveViewHolder(Context context, ViewGroup parentView) { public MainHomeLiveViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -315,7 +318,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
return; return;
} }
intoIndex = 1; intoIndex = 1;
if (gotoRoomKey.isEmpty()) { if (gotoRoomKey!=null&&gotoRoomKey.isEmpty()) {
gotoRoomKey = null; gotoRoomKey = null;
} }
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", gotoRoomKey, 0, liveSdk); LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", gotoRoomKey, 0, liveSdk);
@ -356,9 +359,13 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
ToastUtil.show("暫無法簽到,請稍後再試"); ToastUtil.show("暫無法簽到,請稍後再試");
return; return;
} else { } else {
if(gotoRoomKey==null){
gotoRoomKey=new HashMap<>();
}
gotoRoomKey.put("OPEN", "NEWUSER"); gotoRoomKey.put("OPEN", "NEWUSER");
} }
} }
showLoadingDialog();
if (link.contains("http")) { if (link.contains("http")) {
WebViewActivity.forward(mContext, link, true); WebViewActivity.forward(mContext, link, true);
} else { } else {
@ -372,6 +379,13 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
.start(); .start();
} }
/**
* Banner双击可能会导致进入两次直播间点击Banner后需要展示加载中动画
*/
private void showLoadingDialog(){
mShowLoadingDialog = DialogUitl.loadingDialog(mContext);
mShowLoadingDialog.show();
}
@Override @Override
public void onItemClick(LiveBean bean, int position) { public void onItemClick(LiveBean bean, int position) {
@ -447,4 +461,13 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
} }
@Override
public void onPause() {
super.onPause();
if(mShowLoadingDialog !=null){
mShowLoadingDialog.dismiss();
mShowLoadingDialog =null;
}
}
} }