Small improvement

pull/155/head
M66B 6 years ago
parent 463dc7d36f
commit 3348995a5f

@ -1458,6 +1458,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
webView.setBackgroundColor(Color.TRANSPARENT);
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);
// 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.setId(vwBody.getId());
webView.setVisibility(vwBody.getVisibility());
@ -1469,29 +1488,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
final WebView webView = (WebView) vwBody;
webView.loadUrl("about:blank");
webView.setBackgroundColor(Color.TRANSPARENT);
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.getSettings().setLoadsImagesAutomatically(show_images);
String html = properties.getHtml(message.id);
if (TextUtils.isEmpty(html)) {
webView.loadUrl("about:blank");
Bundle args = new Bundle();
args.putLong("id", message.id);
args.putBoolean("dark", dark);

Loading…
Cancel
Save