update 客服webview新增isZh判断

This commit is contained in:
zlzw 2024-04-01 10:56:44 +08:00
parent ce7b6decc1
commit 1f1ac71bb0

View File

@ -40,7 +40,9 @@ import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.share.ui.InvitePopDialog; import com.yunbao.share.ui.InvitePopDialog;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -72,7 +74,14 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
super.main(); super.main();
Bus.getOn(this); Bus.getOn(this);
String url = getIntent().getStringExtra(Constants.URL); String url = getIntent().getStringExtra(Constants.URL);
L.e("H5-------->" + url); if (StringUtil.isEmpty(url)) {
finish();
return;
}
if (!url.contains("isZh")) {
url += "&isZh=" + (WordUtil.isNewZh() ? 1 : 0);
}
L.e("客服H5-------->" + url);
mProgressBar = (ProgressBar) findViewById(R.id.progressbar); mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
rootView = findViewById(R.id.webView_root); rootView = findViewById(R.id.webView_root);
mWebView = findViewById(R.id.webView); mWebView = findViewById(R.id.webView);
@ -82,7 +91,7 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
params.bottomMargin = getNavigationBarHeight(mContext); params.bottomMargin = getNavigationBarHeight(mContext);
}*/ }*/
//mWebView.setLayoutParams(params); //mWebView.setLayoutParams(params);
// mWebView.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS); // mWebView.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS);
mWebView.setWebViewClient(new WebViewClient() { mWebView.setWebViewClient(new WebViewClient() {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
@ -233,7 +242,7 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
} }
protected boolean canGoBack() { protected boolean canGoBack() {
if (!isKefu(mWebView.getUrl()==null?"":mWebView.getUrl())) { if (!isKefu(mWebView.getUrl() == null ? "" : mWebView.getUrl())) {
mWebView.loadUrl("javascript:userBackShowPraise()"); mWebView.loadUrl("javascript:userBackShowPraise()");
return false; return false;
} }
@ -244,7 +253,7 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (!isKefu(mWebView.getUrl()==null?"":mWebView.getUrl())) { if (!isKefu(mWebView.getUrl() == null ? "" : mWebView.getUrl())) {
finish(); finish();
return; return;
} }