Support to set the font size for plain text on Android

This commit is contained in:
Sebastián Katzer 2019-01-30 14:51:09 +01:00
parent 113dde9f0a
commit 0dac03a168

View File

@ -261,6 +261,7 @@ class PrintManager {
boolean jsEnabled = settings.optBoolean("javascript", false);
WebView view = new WebView(context);
WebSettings spec = view.getSettings();
JSONObject style = settings.optJSONObject("style");
spec.setDatabaseEnabled(true);
spec.setGeolocationEnabled(true);
@ -268,7 +269,13 @@ class PrintManager {
spec.setUseWideViewPort(true);
spec.setJavaScriptEnabled(jsEnabled);
if (SDK_INT >= 21) {
if (style != null && style.has("size"))
{
spec.setDefaultFixedFontSize(style.optInt("size", 16));
}
if (SDK_INT >= 21)
{
spec.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
CookieManager.getInstance().setAcceptThirdPartyCookies(view, true);
}