mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Set WebView default font size
This commit is contained in:
parent
52ebce1a6b
commit
4844003cc9
1 changed files with 20 additions and 0 deletions
|
@ -98,6 +98,26 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
setScrollY(position.second);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean compact = prefs.getBoolean("compact", false);
|
||||
int zoom = prefs.getInt("view_zoom", compact ? 0 : 1);
|
||||
int message_zoom = prefs.getInt("message_zoom", 100);
|
||||
boolean monospaced = prefs.getBoolean("monospaced", false);
|
||||
|
||||
WebSettings settings = getSettings();
|
||||
|
||||
float fontSize = 16f /* Default */ * message_zoom / 100f;
|
||||
if (zoom == 0 /* small */)
|
||||
fontSize *= HtmlHelper.FONT_SMALL;
|
||||
else if (zoom == 2 /* large */)
|
||||
fontSize *= HtmlHelper.FONT_LARGE;
|
||||
|
||||
settings.setDefaultFontSize(Math.round(fontSize));
|
||||
settings.setDefaultFixedFontSize(Math.round(fontSize));
|
||||
|
||||
if (monospaced)
|
||||
settings.setStandardFontFamily("monospace");
|
||||
|
||||
this.intf = intf;
|
||||
|
||||
setWebViewClient(new WebViewClient() {
|
||||
|
|
Loading…
Reference in a new issue