Js接口整合后续更改
This commit is contained in:
parent
4cd1c22d01
commit
a9d323354b
@ -64,15 +64,14 @@ public class JavascriptInterfaceUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JavascriptInterfaceUtils getInstance() {
|
public static JavascriptInterfaceUtils getInstance() {
|
||||||
if (sInstance == null) {
|
|
||||||
synchronized (CityUtil.class) {
|
synchronized (JavascriptInterfaceUtils.class) {
|
||||||
if (sInstance == null) {
|
|
||||||
sInstance = new JavascriptInterfaceUtils();
|
sInstance = new JavascriptInterfaceUtils();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
@ -117,8 +116,13 @@ public class JavascriptInterfaceUtils {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidClickToNewH5PageView(String url) {
|
public void androidClickToNewH5PageView(String url) {
|
||||||
url = CommonAppConfig.HOST + url;
|
url = CommonAppConfig.HOST + url;
|
||||||
|
if (url.contains("?")) {
|
||||||
|
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||||
|
+ CommonAppConfig.getInstance().getToken();
|
||||||
|
} else {
|
||||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||||
+ CommonAppConfig.getInstance().getToken();
|
+ CommonAppConfig.getInstance().getToken();
|
||||||
|
}
|
||||||
if (LiveZhuangBana) {
|
if (LiveZhuangBana) {
|
||||||
RouteUtil.forwardLiveZhuangBanActivity(url, false);
|
RouteUtil.forwardLiveZhuangBanActivity(url, false);
|
||||||
} else {
|
} else {
|
||||||
@ -135,8 +139,13 @@ public class JavascriptInterfaceUtils {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidClickToNewH5PageView(String url, String title) {
|
public void androidClickToNewH5PageView(String url, String title) {
|
||||||
url = CommonAppConfig.HOST + url;
|
url = CommonAppConfig.HOST + url;
|
||||||
|
if (url.contains("?")) {
|
||||||
|
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||||
|
+ CommonAppConfig.getInstance().getToken();
|
||||||
|
} else {
|
||||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||||
+ CommonAppConfig.getInstance().getToken();
|
+ CommonAppConfig.getInstance().getToken();
|
||||||
|
}
|
||||||
if (LiveZhuangBana) {
|
if (LiveZhuangBana) {
|
||||||
RouteUtil.forwardLiveZhuangBanActivity(url, title);
|
RouteUtil.forwardLiveZhuangBanActivity(url, title);
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,9 +10,9 @@ ext {
|
|||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式
|
//正式
|
||||||
|
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//測試
|
//測試
|
||||||
// serverHost : "https://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -97,9 +97,6 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
} else {
|
} else {
|
||||||
if (TextUtils.equals(titleString, "blank")) {
|
if (TextUtils.equals(titleString, "blank")) {
|
||||||
title.setVisibility(View.GONE);
|
title.setVisibility(View.GONE);
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
|
|
||||||
params.topMargin = DpUtil.dp2px(24);
|
|
||||||
rootView.setLayoutParams(params);
|
|
||||||
} else {
|
} else {
|
||||||
title.setVisibility(View.VISIBLE);
|
title.setVisibility(View.VISIBLE);
|
||||||
titleView.setText(titleString);
|
titleView.setText(titleString);
|
||||||
@ -152,9 +149,9 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
// 这个方法在6.0才出现
|
// 这个方法在6.0才出现
|
||||||
int statusCode = errorResponse.getStatusCode();
|
int statusCode = errorResponse.getStatusCode();
|
||||||
if (404 == statusCode || 500 == statusCode) {
|
if (404 == statusCode || 500 == statusCode) {
|
||||||
if ( !request.getUrl().toString().contains("favicon")){
|
if (!request.getUrl().toString().contains("favicon")) {
|
||||||
htmlError.setVisibility(View.VISIBLE);
|
htmlError.setVisibility(View.VISIBLE);
|
||||||
htmlError.setText("errorCode:" + statusCode +"\n failingUrl:" + request.getUrl());
|
htmlError.setText("errorCode:" + statusCode + "\n failingUrl:" + request.getUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebResourceResponse;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
@ -83,9 +85,6 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
lt_title = (LinearLayout) findViewById(R.id.lt_title);
|
lt_title = (LinearLayout) findViewById(R.id.lt_title);
|
||||||
LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView);
|
LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView);
|
||||||
if (getIntent().hasExtra("title")) {
|
if (getIntent().hasExtra("title")) {
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
|
|
||||||
params.topMargin = DpUtil.dp2px(34);
|
|
||||||
rootView.setLayoutParams(params);
|
|
||||||
if (TextUtils.isEmpty(titleString)) {
|
if (TextUtils.isEmpty(titleString)) {
|
||||||
lt_title.setVisibility(View.GONE);
|
lt_title.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
@ -129,7 +128,13 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
} else {
|
} else {
|
||||||
setTitle(titleString);
|
setTitle(titleString);
|
||||||
}
|
}
|
||||||
|
int height = view.getMeasuredHeight();
|
||||||
|
Log.e("网页高度", height + "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
||||||
|
super.onReceivedHttpError(view, request, errorResponse);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:background="@color/color_b14066"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
@ -32,6 +33,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/rootView"
|
android:id="@+id/rootView"
|
||||||
|
android:background="@drawable/backgroud_custom_drawer_popup"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
Loading…
Reference in New Issue
Block a user