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() { 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 {

View File

@ -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",

View File

@ -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);

View File

@ -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() {

View File

@ -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" />