Support to set the font size for plain text on Android
This commit is contained in:
parent
113dde9f0a
commit
0dac03a168
@ -261,6 +261,7 @@ class PrintManager {
|
|||||||
boolean jsEnabled = settings.optBoolean("javascript", false);
|
boolean jsEnabled = settings.optBoolean("javascript", false);
|
||||||
WebView view = new WebView(context);
|
WebView view = new WebView(context);
|
||||||
WebSettings spec = view.getSettings();
|
WebSettings spec = view.getSettings();
|
||||||
|
JSONObject style = settings.optJSONObject("style");
|
||||||
|
|
||||||
spec.setDatabaseEnabled(true);
|
spec.setDatabaseEnabled(true);
|
||||||
spec.setGeolocationEnabled(true);
|
spec.setGeolocationEnabled(true);
|
||||||
@ -268,7 +269,13 @@ class PrintManager {
|
|||||||
spec.setUseWideViewPort(true);
|
spec.setUseWideViewPort(true);
|
||||||
spec.setJavaScriptEnabled(jsEnabled);
|
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);
|
spec.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
CookieManager.getInstance().setAcceptThirdPartyCookies(view, true);
|
CookieManager.getInstance().setAcceptThirdPartyCookies(view, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user