Refactoring

pull/153/head
M66B 6 years ago
parent e5e3e0b76c
commit 4cf09ad087

@ -1426,36 +1426,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
setMeasuredDimension(getMeasuredWidth(), tvBody.getMinHeight());
}
};
webView.setId(vwBody.getId());
webView.setVisibility(vwBody.getVisibility());
ConstraintLayout cl = (ConstraintLayout) view;
cl.removeView(vwBody);
cl.addView(webView, vwBody.getLayoutParams());
vwBody = webView;
}
final WebView webView = (WebView) vwBody;
webView.loadUrl("about:blank");
WebSettings settings = webView.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
settings.setAllowFileAccess(false);
settings.setLoadsImagesAutomatically(show_images);
// Set default font
int px = Math.round(TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_PX, textSize,
context.getResources().getDisplayMetrics()));
settings.setDefaultFontSize(px);
if (monospaced)
settings.setStandardFontFamily("monospace");
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
@ -1520,6 +1490,37 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
webView.setId(vwBody.getId());
webView.setVisibility(vwBody.getVisibility());
ConstraintLayout cl = (ConstraintLayout) view;
cl.removeView(vwBody);
cl.addView(webView, vwBody.getLayoutParams());
vwBody = webView;
}
final WebView webView = (WebView) vwBody;
webView.loadUrl("about:blank");
WebSettings settings = webView.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
settings.setAllowFileAccess(false);
settings.setLoadsImagesAutomatically(show_images);
// Set default font
int px = Math.round(TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_PX, textSize,
context.getResources().getDisplayMetrics()));
settings.setDefaultFontSize(px);
if (monospaced)
settings.setStandardFontFamily("monospace");
String html = properties.getHtml(message.id);
if (TextUtils.isEmpty(html)) {
Bundle args = new Bundle();

Loading…
Cancel
Save