Example usage for android.webkit WebSettings setMinimumLogicalFontSize

List of usage examples for android.webkit WebSettings setMinimumLogicalFontSize

Introduction

In this page you can find the example usage for android.webkit WebSettings setMinimumLogicalFontSize.

Prototype

public abstract void setMinimumLogicalFontSize(int size);

Source Link

Document

Sets the minimum logical font size.

Usage

From source file:com.acrutiapps.browser.ui.components.CustomWebView.java

@SuppressLint("SetJavaScriptEnabled")
public void loadSettings() {
    WebSettings settings = getSettings();
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());

    settings.setJavaScriptEnabled(prefs.getBoolean(Constants.PREFERENCE_ENABLE_JAVASCRIPT, true));
    settings.setLoadsImagesAutomatically(prefs.getBoolean(Constants.PREFERENCE_ENABLE_IMAGES, true));
    settings.setUseWideViewPort(prefs.getBoolean(Constants.PREFERENCE_USE_WIDE_VIEWPORT, true));
    settings.setLoadWithOverviewMode(prefs.getBoolean(Constants.PREFERENCE_LOAD_WITH_OVERVIEW, false));

    settings.setGeolocationEnabled(prefs.getBoolean(Constants.PREFERENCE_ENABLE_GEOLOCATION, true));
    settings.setSaveFormData(prefs.getBoolean(Constants.PREFERENCE_REMEMBER_FORM_DATA, true));
    settings.setSavePassword(prefs.getBoolean(Constants.PREFERENCE_REMEMBER_PASSWORDS, true));

    settings.setTextZoom(prefs.getInt(Constants.PREFERENCE_TEXT_SCALING, 100));

    int minimumFontSize = prefs.getInt(Constants.PREFERENCE_MINIMUM_FONT_SIZE, 1);
    settings.setMinimumFontSize(minimumFontSize);
    settings.setMinimumLogicalFontSize(minimumFontSize);

    boolean useInvertedDisplay = prefs.getBoolean(Constants.PREFERENCE_INVERTED_DISPLAY, false);
    setWebSettingsProperty(settings, "inverted", useInvertedDisplay ? "true" : "false");

    if (useInvertedDisplay) {
        setWebSettingsProperty(settings, "inverted_contrast",
                Float.toString(prefs.getInt(Constants.PREFERENCE_INVERTED_DISPLAY_CONTRAST, 100) / 100f));
    }/*from ww w.  j a  v  a  2s.c o m*/

    settings.setUserAgentString(prefs.getString(Constants.PREFERENCE_USER_AGENT, Constants.USER_AGENT_ANDROID));
    settings.setPluginState(PluginState
            .valueOf(prefs.getString(Constants.PREFERENCE_PLUGINS, PluginState.ON_DEMAND.toString())));

    CookieManager.getInstance().setAcceptCookie(prefs.getBoolean(Constants.PREFERENCE_ACCEPT_COOKIES, true));

    settings.setSupportZoom(true);
    settings.setDisplayZoomControls(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportMultipleWindows(true);
    settings.setEnableSmoothTransition(true);

    if (mPrivateBrowsing) {
        settings.setGeolocationEnabled(false);
        settings.setSaveFormData(false);
        settings.setSavePassword(false);

        settings.setAppCacheEnabled(false);
        settings.setDatabaseEnabled(false);
        settings.setDomStorageEnabled(false);
    } else {
        // HTML5 API flags
        settings.setAppCacheEnabled(true);
        settings.setDatabaseEnabled(true);
        settings.setDomStorageEnabled(true);

        // HTML5 configuration settings.
        settings.setAppCacheMaxSize(3 * 1024 * 1024);
        settings.setAppCachePath(mContext.getDir("appcache", 0).getPath());
        settings.setDatabasePath(mContext.getDir("databases", 0).getPath());
        settings.setGeolocationDatabasePath(mContext.getDir("geolocation", 0).getPath());
    }

    setLongClickable(true);
    setDownloadListener(this);
}