调整弹窗
This commit is contained in:
parent
0396e2d06d
commit
9764b3370e
@ -119,10 +119,10 @@ public class OpenAdModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
if (!url.startsWith("http://") || !url.startsWith("https://")) {
|
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||||
url = CommonAppConfig.HOST + (url.startsWith("/") ? url : "/" + url);
|
url = CommonAppConfig.HOST + (url.startsWith("/") ? url : "/" + url);
|
||||||
}
|
}
|
||||||
return url + "?t=" + System.currentTimeMillis() / 1000;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOriginalUrl() {
|
public String getOriginalUrl() {
|
||||||
|
@ -3,6 +3,7 @@ package com.yunbao.common.dialog;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
|||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -95,6 +97,19 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
|||||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||||
mWebView.setHorizontalScrollBarEnabled(false);
|
mWebView.setHorizontalScrollBarEnabled(false);
|
||||||
mWebView.setVerticalScrollBarEnabled(false);
|
mWebView.setVerticalScrollBarEnabled(false);
|
||||||
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
L.e("H5-------->" + url);
|
||||||
|
view.loadUrl(url);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
}
|
||||||
|
});
|
||||||
String url=model.getUrl();
|
String url=model.getUrl();
|
||||||
if(url.contains("?")){
|
if(url.contains("?")){
|
||||||
url+="&uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
|
url+="&uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||||
|
@ -5,9 +5,12 @@ import android.content.Context;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
@ -24,8 +27,10 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
|||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
@ -126,7 +131,7 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
|||||||
|
|
||||||
private void setWeb(OpenAdModel model, int width, int height) {
|
private void setWeb(OpenAdModel model, int width, int height) {
|
||||||
WebView mWebView = new WebView(mContext);
|
WebView mWebView = new WebView(mContext);
|
||||||
mWebView.setLayoutParams(new LinearLayout.LayoutParams(width, height));
|
mWebView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height));
|
||||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
@ -138,6 +143,19 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
|||||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||||
mWebView.setHorizontalScrollBarEnabled(false);
|
mWebView.setHorizontalScrollBarEnabled(false);
|
||||||
mWebView.setVerticalScrollBarEnabled(false);
|
mWebView.setVerticalScrollBarEnabled(false);
|
||||||
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
L.e("H5-------->" + url);
|
||||||
|
view.loadUrl(url);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
}
|
||||||
|
});
|
||||||
String url = model.getUrl();
|
String url = model.getUrl();
|
||||||
if (url.contains("?")) {
|
if (url.contains("?")) {
|
||||||
url += "&uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
|
url += "&uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||||
|
Loading…
Reference in New Issue
Block a user