修复在线客服页面输入法会挡住输入框的问题

This commit is contained in:
zlzw 2023-05-31 16:51:00 +08:00
parent 282790ead5
commit 56845de59d
3 changed files with 10 additions and 3 deletions

View File

@ -82,7 +82,6 @@ public class WebViewActivity extends AbsActivity {
ft_title = (FrameLayout) findViewById(R.id.ft_title); ft_title = (FrameLayout) findViewById(R.id.ft_title);
v_spacing = (View) findViewById(R.id.v_spacing); v_spacing = (View) findViewById(R.id.v_spacing);
mWebView = findViewById(R.id.webView); mWebView = findViewById(R.id.webView);
AndroidBug5497Workaround.assistActivity(this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.topMargin = DpUtil.dp2px(1); params.topMargin = DpUtil.dp2px(1);
@ -110,10 +109,11 @@ public class WebViewActivity extends AbsActivity {
mWebView.loadUrl("javascript:goAnchorTab()"); mWebView.loadUrl("javascript:goAnchorTab()");
} }
//真实屏幕高度-(ft_title的高度+导航栏高度) //真实屏幕高度-(ft_title的高度+导航栏高度)
int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext); //屏蔽掉是因为在线客服页面 AndroidBug5497Workaround会失效
/* int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext);
if (!navigationGestureEnabled(mContext)) { if (!navigationGestureEnabled(mContext)) {
view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)"); view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
} }*/
} }
}); });
@ -171,6 +171,7 @@ public class WebViewActivity extends AbsActivity {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
mWebView.loadUrl(url); mWebView.loadUrl(url);
AndroidBug5497Workaround.assistActivity(this);
if (Constants.myIntoIndex == 2) { if (Constants.myIntoIndex == 2) {
ft_title.setVisibility(View.GONE); ft_title.setVisibility(View.GONE);

View File

@ -6,6 +6,10 @@ import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.FrameLayout; import android.widget.FrameLayout;
/**
* 修复全屏WebView输入法遮挡输入框的问题
* <a href="https://github.com/madebycm/AndroidBug5497Workaround/tree/master">GitHub</a>
*/
public class AndroidBug5497Workaround { public class AndroidBug5497Workaround {
// For more information, see https://issuetracker.google.com/issues/36911528 // For more information, see https://issuetracker.google.com/issues/36911528

View File

@ -36,6 +36,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.AndroidBug5497Workaround;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.JavascriptInterfaceUtils;
@ -185,6 +186,7 @@ public class ZhuangBanActivity extends AbsActivity {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
mWebView.loadUrl(url); mWebView.loadUrl(url);
AndroidBug5497Workaround.assistActivity(this);
} }