Small improvement

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

@ -1458,18 +1458,6 @@ 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");
webView.setBackgroundColor(Color.TRANSPARENT); webView.setBackgroundColor(Color.TRANSPARENT);
WebSettings settings = webView.getSettings(); WebSettings settings = webView.getSettings();
@ -1480,7 +1468,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setDisplayZoomControls(false); settings.setDisplayZoomControls(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
settings.setAllowFileAccess(false); settings.setAllowFileAccess(false);
settings.setLoadsImagesAutomatically(show_images);
// Set default font // Set default font
int px = Math.round(TypedValue.applyDimension( int px = Math.round(TypedValue.applyDimension(
@ -1490,8 +1477,23 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (monospaced) if (monospaced)
settings.setStandardFontFamily("monospace"); settings.setStandardFontFamily("monospace");
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.getSettings().setLoadsImagesAutomatically(show_images);
String html = properties.getHtml(message.id); String html = properties.getHtml(message.id);
if (TextUtils.isEmpty(html)) { if (TextUtils.isEmpty(html)) {
webView.loadUrl("about:blank");
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", message.id); args.putLong("id", message.id);
args.putBoolean("dark", dark); args.putBoolean("dark", dark);

Loading…
Cancel
Save