From 5a32047c6dcb7af1e0dfe791cfbb24fbf5e200e9 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Wed, 24 Jan 2024 14:43:31 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=A2=E6=9C=8DWebView?=
=?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=9C=8Durl=E5=88=A4=E6=96=AD?=
=?UTF-8?q?=E9=93=BE=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/yunbao/common/activity/AbsActivity.java | 6 ++++++
.../yunbao/common/utils/AndroidBug5497Workaround.java | 4 +++-
.../main/activity/CustomerServiceWebViewActivity.java | 10 ++++------
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java
index c25d8d07d..59851d060 100644
--- a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java
+++ b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java
@@ -383,6 +383,12 @@ public abstract class AbsActivity extends AppCompatActivity {
}
}
public boolean isKefu(String url){
+ if(url.contains("kefu")){
+ return true;
+ }
+ if(url.contains("https://newkf.yaoulive.com/")){
+ return true;
+ }
return url.startsWith("https://kefu.yaoulive.com");
}
}
diff --git a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java
index 284d2f9fa..ef2fb8c84 100644
--- a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java
+++ b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java
@@ -9,6 +9,8 @@ import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
+import com.yunbao.common.activity.AbsActivity;
+
/**
* 修复全屏WebView输入法遮挡输入框的问题
* GitHub
@@ -72,7 +74,7 @@ public class AndroidBug5497Workaround {
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
if (heightDifference > (usableHeightSansKeyboard / 4)) {
// keyboard probably just became visible
- frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
+ frameLayoutParams.height = usableHeightSansKeyboard - heightDifference - AbsActivity.getCurrentNavigationBarHeight((Activity) mChildOfContent.getContext());
} else {
// keyboard probably just became hidden
frameLayoutParams.height = usableHeightSansKeyboard;
diff --git a/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
index a7407ff0e..4b114430e 100644
--- a/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
@@ -81,9 +81,8 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
if (getNavigationBarHeight(mContext) != 0) {
params.bottomMargin = getNavigationBarHeight(mContext);
}*/
- AndroidBug5497Workaround.assistActivity(rootView);
//mWebView.setLayoutParams(params);
- mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
+ // mWebView.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
@@ -172,13 +171,12 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
String appCachePath = mContext.getCacheDir().getAbsolutePath();
// mWebView.getSettings().setAppCachePath(appCachePath);
mWebView.getSettings().setAllowFileAccess(true);
- mWebView.getSettings().setUseWideViewPort(true); // 关键点
+ //mWebView.getSettings().setUseWideViewPort(true); // 关键点
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
- }
+ mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
mWebView.loadUrl(url);
+ AndroidBug5497Workaround.assistActivity(mWebView);
}
private void openImageChooserActivity(ValueCallback valueCallback) {
From 50fb801cf73d62598fe1facd1eed3df341942e63 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Wed, 24 Jan 2024 14:52:44 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA?=
=?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yunbao/main/activity/CustomerServiceWebViewActivity.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
index 4b114430e..2a0149b37 100644
--- a/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/CustomerServiceWebViewActivity.java
@@ -248,7 +248,7 @@ public class CustomerServiceWebViewActivity extends AbsActivity {
finish();
return;
}
- ToastUtil.showDebug("调用js userBackShowPraise");
+ ToastUtil.show("调用js userBackShowPraise");
mWebView.loadUrl("javascript:userBackShowPraise()");
}