修复活动banner快速点击会多次打开的问题
This commit is contained in:
parent
cccde7a3f8
commit
92ec8a3044
@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
@ -69,6 +70,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
||||
private int activityId = -1;
|
||||
private LinearLayout layout;
|
||||
private boolean isFullWindow = false;
|
||||
private DialogInterface.OnShowListener listener;
|
||||
|
||||
public LiveGameDialogFragment() {
|
||||
|
||||
@ -89,6 +91,10 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
|
||||
public void setShowListener(DialogInterface.OnShowListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_live_game;
|
||||
@ -167,6 +173,9 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
// view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)");
|
||||
if (listener != null) {
|
||||
listener.onShow(LiveGameDialogFragment.this.getDialog());
|
||||
}
|
||||
}
|
||||
});
|
||||
initData();
|
||||
@ -224,7 +233,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
||||
for (int i = 0; i < count; i++) {
|
||||
ActiveModel model = (ActiveModel) tabLayout.getTabAt(i).getTag();
|
||||
if ((activityId + "").equals(model.getActiveId())) {
|
||||
tabIndex=i;
|
||||
tabIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -270,6 +279,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
@JavascriptInterface
|
||||
|
@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
@ -57,6 +58,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
private int showType = 0;
|
||||
private boolean isFullWindow = false;
|
||||
private String roomId;
|
||||
private DialogInterface.OnShowListener listener;
|
||||
|
||||
public LiveHDDialogFragment() {
|
||||
|
||||
@ -86,6 +88,10 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setShowListener(DialogInterface.OnShowListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
|
||||
@ -172,6 +178,9 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)");
|
||||
if (listener != null) {
|
||||
listener.onShow(LiveHDDialogFragment.this.getDialog());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (bundle.getBoolean("banScrollY", false)) {
|
||||
@ -280,12 +289,12 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidSignGift(String json) {
|
||||
JSONObject data=JSONObject.parseObject(json);
|
||||
if(data!=null) {
|
||||
// 恭喜您第一天簽到成功!
|
||||
JSONObject data = JSONObject.parseObject(json);
|
||||
if (data != null) {
|
||||
// 恭喜您第一天簽到成功!
|
||||
((LiveAudienceActivity) mContext).openSignWindow(data.getString("icon"),
|
||||
data.getString("name"),
|
||||
"恭喜您" +data.getString("desc")+"簽到成功!"
|
||||
"恭喜您" + data.getString("desc") + "簽到成功!"
|
||||
);
|
||||
}
|
||||
|
||||
@ -294,13 +303,13 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
|
||||
@JavascriptInterface
|
||||
public void setHeight(String height, String width) {
|
||||
if("0".equals(height)){
|
||||
if ("0".equals(height)) {
|
||||
return;
|
||||
}
|
||||
Handler handler=new Handler(Looper.getMainLooper());
|
||||
handler.post(()->{
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(() -> {
|
||||
ViewGroup.LayoutParams params = mWebView.getLayoutParams();
|
||||
params.height=DpUtil.dp2px(Integer.parseInt(height));
|
||||
params.height = DpUtil.dp2px(Integer.parseInt(height));
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
|
@ -7,10 +7,12 @@ import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Outline;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
@ -3002,28 +3004,34 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
public void onBannerClick(List datas, int p) {
|
||||
Log.i("debug", "onBannerClick: " + mBannerList4.get(p).toString());
|
||||
BannerBean bean = mBannerList4.get(p);
|
||||
loadingDialog = DialogUitl.loadingDialog(mContext);
|
||||
loadingDialog.show();
|
||||
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setActivity(true)
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
|
||||
if (loadingDialog != null && loadingDialog.isShowing()) {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}
|
||||
} else if (bean.getActivityId() == 0) {
|
||||
openWebDialog(bean.getLink());
|
||||
} else {
|
||||
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type()));
|
||||
fragment.setActivityId(bean.getActivityId());
|
||||
fragment.setRoomId(mLiveUid);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||
if (loadingDialog != null && loadingDialog.isShowing()) {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}
|
||||
if (loadingDialog == null) {
|
||||
loadingDialog = DialogUitl.loadingDialog(mContext, WordUtil.getString(R.string.login_wait));
|
||||
}
|
||||
loadingDialog.setOnShowListener(dialog -> {
|
||||
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setActivity(true)
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}, 300);
|
||||
} else if (bean.getActivityId() == 0) {
|
||||
openWebDialog(bean.getLink());
|
||||
} else {
|
||||
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type()));
|
||||
fragment.setActivityId(bean.getActivityId());
|
||||
fragment.setRoomId(mLiveUid);
|
||||
fragment.setShowListener(dialog1 -> {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}, 300);
|
||||
});
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||
}
|
||||
});
|
||||
loadingDialog.show();
|
||||
}
|
||||
|
||||
|
||||
@ -3047,11 +3055,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
bundle1.putString("url", url);
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
liveHDDialogFragment.setArguments(bundle1);
|
||||
liveHDDialogFragment.setShowListener(dialog1 -> {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}, 300);
|
||||
});
|
||||
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
if (loadingDialog != null && loadingDialog.isShowing()) {
|
||||
loadingDialog.dismiss();
|
||||
loadingDialog = null;
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.start();
|
||||
|
Loading…
Reference in New Issue
Block a user