Fields Summary |
---|
private boolean | loadsImagesAutomatically |
private boolean | javaScriptEnabled |
private boolean | pluginsEnabled |
private String | pluginsPath |
private boolean | javaScriptCanOpenWindowsAutomatically |
private boolean | showSecurityWarnings |
private boolean | rememberPasswords |
private boolean | saveFormData |
private boolean | openInBackground |
private String | defaultTextEncodingName |
private String | homeUrl |
private boolean | loginInitialized |
private boolean | autoFitPage |
private boolean | showDebugSettings |
public WebSettings.LayoutAlgorithm | layoutAlgorithm |
private boolean | useWideViewPort |
private int | userAgent |
private boolean | tracing |
private boolean | lightTouch |
private boolean | navDump |
private boolean | doFlick |
private static int | minimumFontSize |
private static int | minimumLogicalFontSize |
private static int | defaultFontSize |
private static int | defaultFixedFontSize |
private static WebSettings.TextSize | textSize |
public static final String | PREF_CLEAR_CACHE |
public static final String | PREF_CLEAR_COOKIES |
public static final String | PREF_CLEAR_HISTORY |
public static final String | PREF_HOMEPAGE |
public static final String | PREF_CLEAR_FORM_DATA |
public static final String | PREF_CLEAR_PASSWORDS |
public static final String | PREF_EXTRAS_RESET_DEFAULTS |
public static final String | PREF_DEBUG_SETTINGS |
public static final String | PREF_GEARS_SETTINGS |
public static final String | PREF_TEXT_SIZE |
public static final String | PREF_DEFAULT_TEXT_ENCODING |
private static final String | DESKTOP_USERAGENT |
private static final String | IPHONE_USERAGENT |
public static final int | MAX_TEXTVIEW_LEN |
private TabControl | mTabControl |
private static BrowserSettings | sSingleton |
private HashMap | mWebSettingsToObservers |
Methods Summary |
---|
public com.android.browser.BrowserSettings$Observer | addObserver(android.webkit.WebSettings s)Add a WebSettings object to the list of observers that will be updated
when update() is called.
Observer old = mWebSettingsToObservers.get(s);
if (old != null) {
super.deleteObserver(old);
}
Observer o = new Observer(s);
mWebSettingsToObservers.put(s, o);
super.addObserver(o);
return o;
|
void | clearCache(android.content.Context context)
WebIconDatabase.getInstance().removeAllIcons();
if (mTabControl != null) {
WebView current = mTabControl.getCurrentWebView();
if (current != null) {
current.clearCache(true);
}
}
|
void | clearCookies(android.content.Context context)
CookieManager.getInstance().removeAllCookie();
|
void | clearFormData(android.content.Context context)
WebViewDatabase.getInstance(context).clearFormData();
if (mTabControl != null) {
mTabControl.getCurrentTopWebView().clearFormData();
}
|
void | clearHistory(android.content.Context context)
ContentResolver resolver = context.getContentResolver();
Browser.clearHistory(resolver);
Browser.clearSearches(resolver);
|
void | clearPasswords(android.content.Context context)
WebViewDatabase db = WebViewDatabase.getInstance(context);
db.clearUsernamePassword();
db.clearHttpAuthUsernamePassword();
|
public void | deleteObserver(android.webkit.WebSettings s)Delete the given WebSettings observer from the list of observers.
Observer o = mWebSettingsToObservers.get(s);
if (o != null) {
mWebSettingsToObservers.remove(s);
super.deleteObserver(o);
}
|
public boolean | doFlick()
return doFlick;
|
public java.lang.String | getHomePage()
return homeUrl;
|
static com.android.browser.BrowserSettings | getInstance()
if (sSingleton == null ) {
sSingleton = new BrowserSettings();
}
return sSingleton;
|
public java.lang.String | getPluginsPath()
return pluginsPath;
|
public WebSettings.TextSize | getTextSize()
return textSize;
|
public boolean | isLightTouch()
return lightTouch;
|
public boolean | isLoginInitialized()
return loginInitialized;
|
public boolean | isNavDump()
return navDump;
|
public boolean | isTracing()
return tracing;
|
public void | loadFromDb(android.content.Context ctx)Load settings from the browser app's database.
NOTE: Strings used for the preferences must match those specified
in the browser_preferences.xml
SharedPreferences p =
PreferenceManager.getDefaultSharedPreferences(ctx);
// Set the default value for the plugins path to the application's
// local directory.
pluginsPath = ctx.getDir("plugins", 0).getPath();
homeUrl += Partner.getString(ctx.getContentResolver(), Partner.CLIENT_ID);
// Load the defaults from the xml
// This call is TOO SLOW, need to manually keep the defaults
// in sync
//PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences);
syncSharedPreferences(p);
|
public boolean | openInBackground()
return openInBackground;
|
void | resetDefaultPreferences(android.content.Context context)
SharedPreferences p =
PreferenceManager.getDefaultSharedPreferences(context);
p.edit().clear().commit();
PreferenceManager.setDefaultValues(context, R.xml.browser_preferences,
true);
|
public void | setHomePage(android.content.Context context, java.lang.String url)
Editor ed = PreferenceManager.
getDefaultSharedPreferences(context).edit();
ed.putString(PREF_HOMEPAGE, url);
ed.commit();
homeUrl = url;
|
public void | setLoginInitialized(android.content.Context context)
loginInitialized = true;
Editor ed = PreferenceManager.
getDefaultSharedPreferences(context).edit();
ed.putBoolean("login_initialized", loginInitialized);
ed.commit();
|
void | setTabControl(TabControl tabControl)
mTabControl = tabControl;
|
public boolean | showDebugSettings()
return showDebugSettings;
|
public boolean | showSecurityWarnings()
return showSecurityWarnings;
|
void | syncSharedPreferences(android.content.SharedPreferences p)
homeUrl =
p.getString(PREF_HOMEPAGE, homeUrl);
loadsImagesAutomatically = p.getBoolean("load_images",
loadsImagesAutomatically);
javaScriptEnabled = p.getBoolean("enable_javascript",
javaScriptEnabled);
pluginsEnabled = p.getBoolean("enable_plugins",
pluginsEnabled);
pluginsPath = p.getString("plugins_path", pluginsPath);
javaScriptCanOpenWindowsAutomatically = !p.getBoolean(
"block_popup_windows",
!javaScriptCanOpenWindowsAutomatically);
showSecurityWarnings = p.getBoolean("show_security_warnings",
showSecurityWarnings);
rememberPasswords = p.getBoolean("remember_passwords",
rememberPasswords);
saveFormData = p.getBoolean("save_formdata",
saveFormData);
boolean accept_cookies = p.getBoolean("accept_cookies",
CookieManager.getInstance().acceptCookie());
CookieManager.getInstance().setAcceptCookie(accept_cookies);
openInBackground = p.getBoolean("open_in_background", openInBackground);
loginInitialized = p.getBoolean("login_initialized", loginInitialized);
textSize = WebSettings.TextSize.valueOf(
p.getString(PREF_TEXT_SIZE, textSize.name()));
autoFitPage = p.getBoolean("autofit_pages", autoFitPage);
useWideViewPort = true; // use wide view port for either setting
if (autoFitPage) {
layoutAlgorithm = WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
} else {
layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
}
defaultTextEncodingName =
p.getString(PREF_DEFAULT_TEXT_ENCODING,
defaultTextEncodingName);
showDebugSettings =
p.getBoolean(PREF_DEBUG_SETTINGS, showDebugSettings);
// Debug menu items have precidence if the menu is visible
if (showDebugSettings) {
boolean small_screen = p.getBoolean("small_screen",
layoutAlgorithm ==
WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
if (small_screen) {
layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN;
} else {
boolean normal_layout = p.getBoolean("normal_layout",
layoutAlgorithm == WebSettings.LayoutAlgorithm.NORMAL);
if (normal_layout) {
layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
} else {
layoutAlgorithm =
WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
}
}
useWideViewPort = p.getBoolean("wide_viewport", useWideViewPort);
tracing = p.getBoolean("enable_tracing", tracing);
lightTouch = p.getBoolean("enable_light_touch", lightTouch);
navDump = p.getBoolean("enable_nav_dump", navDump);
doFlick = p.getBoolean("enable_flick", doFlick);
userAgent = Integer.parseInt(p.getString("user_agent", "0"));
mTabControl.getBrowserActivity().setBaseSearchUrl(
p.getString("search_url", ""));
}
update();
|
public void | toggleDebugSettings()
showDebugSettings = !showDebugSettings;
navDump = showDebugSettings;
update();
|
void | update()
setChanged();
notifyObservers();
|