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