Js接口整合后续更改

This commit is contained in:
18401019693 2022-11-21 15:22:54 +08:00
parent 4cd1c22d01
commit a9d323354b
5 changed files with 34 additions and 21 deletions

View File

@ -64,15 +64,14 @@ public class JavascriptInterfaceUtils {
}
public static JavascriptInterfaceUtils getInstance() {
if (sInstance == null) {
synchronized (CityUtil.class) {
if (sInstance == null) {
synchronized (JavascriptInterfaceUtils.class) {
sInstance = new JavascriptInterfaceUtils();
}
}
}
return sInstance;
}
}
@JavascriptInterface
@ -117,8 +116,13 @@ public class JavascriptInterfaceUtils {
@JavascriptInterface
public void androidClickToNewH5PageView(String url) {
url = CommonAppConfig.HOST + url;
if (url.contains("?")) {
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
} else {
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
}
if (LiveZhuangBana) {
RouteUtil.forwardLiveZhuangBanActivity(url, false);
} else {
@ -135,8 +139,13 @@ public class JavascriptInterfaceUtils {
@JavascriptInterface
public void androidClickToNewH5PageView(String url, String title) {
url = CommonAppConfig.HOST + url;
if (url.contains("?")) {
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
} else {
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
}
if (LiveZhuangBana) {
RouteUtil.forwardLiveZhuangBanActivity(url, title);
} else {

View File

@ -10,9 +10,9 @@ ext {
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",

View File

@ -97,9 +97,6 @@ public class ZhuangBanActivity extends AbsActivity {
} else {
if (TextUtils.equals(titleString, "blank")) {
title.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
params.topMargin = DpUtil.dp2px(24);
rootView.setLayoutParams(params);
} else {
title.setVisibility(View.VISIBLE);
titleView.setText(titleString);

View File

@ -16,6 +16,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -83,9 +85,6 @@ public class ZhuangBanActivity extends AbsActivity {
lt_title = (LinearLayout) findViewById(R.id.lt_title);
LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView);
if (getIntent().hasExtra("title")) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
params.topMargin = DpUtil.dp2px(34);
rootView.setLayoutParams(params);
if (TextUtils.isEmpty(titleString)) {
lt_title.setVisibility(View.GONE);
} else {
@ -129,7 +128,13 @@ public class ZhuangBanActivity extends AbsActivity {
} else {
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() {

View File

@ -21,6 +21,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:background="@color/color_b14066"
android:layout_height="match_parent">
<ProgressBar
@ -32,6 +33,7 @@
<LinearLayout
android:id="@+id/rootView"
android:background="@drawable/backgroud_custom_drawer_popup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />