调整webView

调整客服页面
This commit is contained in:
2024-01-19 10:43:40 +08:00
parent d6e6164549
commit 16755a9c8c
5 changed files with 45 additions and 15 deletions

View File

@@ -30,6 +30,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.LifeCycleListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.ClickUtil;
import com.yunbao.common.utils.ToastUtil;
import java.util.ArrayList;
import java.util.List;
@@ -381,5 +382,7 @@ public abstract class AbsActivity extends AppCompatActivity {
break;
}
}
public boolean isKefu(String url){
return url.startsWith("https://kefu.yaoulive.com");
}
}

View File

@@ -186,7 +186,7 @@ public class WebViewActivity extends AbsActivity {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
mWebView.loadUrl(url);
AndroidBug5497Workaround.assistActivity(this);
AndroidBug5497Workaround.assistActivity(mWebView);
if (Constants.myIntoIndex == 2) {
ft_title.setVisibility(View.GONE);

View File

@@ -21,11 +21,14 @@ public class AndroidBug5497Workaround {
public static void assistActivity(Activity activity) {
new AndroidBug5497Workaround(activity);
}
public static void assistActivity(View webView) {
new AndroidBug5497Workaround(webView);
}
private View mChildOfContent;
private int usableHeightPrevious;
private int defHeight = ViewGroup.LayoutParams.MATCH_PARENT;
private FrameLayout.LayoutParams frameLayoutParams;
private ViewGroup.LayoutParams frameLayoutParams;
private AndroidBug5497Workaround(Activity activity) {
FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);
@@ -34,6 +37,7 @@ public class AndroidBug5497Workaround {
public void onGlobalLayout() {
possiblyResizeChildOfContent();
int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight();
System.out.println("heightDiff = " + heightDiff);
if (heightDiff < 100) {
frameLayoutParams.height = defHeight;
mChildOfContent.requestLayout();
@@ -41,7 +45,24 @@ public class AndroidBug5497Workaround {
}
});
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
frameLayoutParams = (ViewGroup.LayoutParams) mChildOfContent.getLayoutParams();
}
public AndroidBug5497Workaround(View content) {
mChildOfContent = content;
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
possiblyResizeChildOfContent();
int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight();
System.out.println("heightDiff = " + heightDiff);
if (heightDiff < 100) {
frameLayoutParams.height = defHeight;
mChildOfContent.requestLayout();
}
}
});
frameLayoutParams = (ViewGroup.LayoutParams) mChildOfContent.getLayoutParams();
}
private void possiblyResizeChildOfContent() {