测试更改
This commit is contained in:
@@ -139,7 +139,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
|
||||
});
|
||||
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mWebView.getSettings().setDomStorageEnabled(true);
|
||||
|
||||
@@ -40,6 +40,7 @@ public class JavascriptInterfaceUtils {
|
||||
private boolean dialogClose = false;
|
||||
//同名activity跳转问题
|
||||
private boolean LiveZhuangBana = true;
|
||||
private static JavascriptInterfaceUtils sInstance;
|
||||
|
||||
public JavascriptInterfaceUtils setPageClose(boolean pageClose) {
|
||||
this.pageClose = pageClose;
|
||||
@@ -56,9 +57,21 @@ public class JavascriptInterfaceUtils {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceUtils(Activity mContext, WebView mWebView) {
|
||||
public JavascriptInterfaceUtils setmContext(Activity mContext, WebView mWebView) {
|
||||
this.mContext = mContext;
|
||||
this.mWebView = mWebView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static JavascriptInterfaceUtils getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (CityUtil.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new JavascriptInterfaceUtils();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
@@ -453,6 +466,7 @@ public class JavascriptInterfaceUtils {
|
||||
.setData(json));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void setHeight(String height, String width) {
|
||||
if ("0".equals(height)) {
|
||||
|
||||
Reference in New Issue
Block a user