<string name="pref_content_search_engine">Set search engine</string>
<!-- Settings summary -->
<string name="pref_content_search_engine_summary">Select a search engine</string>
- <!-- Settings label -->
- <string name="pref_content_show_search_suggestions">Show web suggestions</string>
- <!-- Settings summary -->
- <string name="pref_content_show_web_suggestions_summary_on">Show web suggestions as you type</string>
- <!-- Settings summary -->
- <string name="pref_content_show_web_suggestions_summary_off">Don\'t show web suggestions as you type</string>
<!-- Settings button label -->
<string name="pref_use_current">Use current page</string>
<!-- Settings label -->
android:summary="@string/pref_content_search_engine_summary"
android:dialogTitle="@string/pref_content_search_engine" />
- <CheckBoxPreference
- android:key="show_search_suggestions"
- android:defaultValue="true"
- android:title="@string/pref_content_show_search_suggestions"
- android:summaryOn="@string/pref_content_show_web_suggestions_summary_on"
- android:summaryOff="@string/pref_content_show_web_suggestions_summary_off" />
-
<PreferenceScreen
android:key="website_settings"
android:title="@string/pref_extras_website_settings"
private String defaultTextEncodingName;
private String homeUrl = "";
private SearchEngine searchEngine;
- private boolean showSearchSuggestions;
private boolean autoFitPage;
private boolean landscapeOnly;
private boolean loadsPageInOverviewMode;
public final static String PREF_CLEAR_HISTORY = "privacy_clear_history";
public final static String PREF_HOMEPAGE = "homepage";
public final static String PREF_SEARCH_ENGINE = "search_engine";
- public final static String PREF_SHOW_SEARCH_SUGGESTIONS = "show_search_suggestions";
public final static String PREF_CLEAR_FORM_DATA =
"privacy_clear_form_data";
public final static String PREF_CLEAR_PASSWORDS =
pageCacheCapacity = 1;
}
- final ContentResolver cr = ctx.getContentResolver();
- cr.registerContentObserver(
- Settings.System.getUriFor(Settings.System.SHOW_WEB_SUGGESTIONS), false,
- new ContentObserver(new Handler()) {
- @Override
- public void onChange(boolean selfChange) {
- SharedPreferences p =
- PreferenceManager.getDefaultSharedPreferences(ctx);
- updateShowWebSuggestions(cr, p);
- }
- });
- updateShowWebSuggestions(cr, p);
-
// Load the defaults from the xml
// This call is TOO SLOW, need to manually keep the defaults
// in sync
searchEngine = SearchEngines.get(ctx, searchEngineName);
}
Log.i(TAG, "Selected search engine: " + searchEngine);
- showSearchSuggestions = p.getBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, true);
- // Persist to system settings
- saveShowWebSuggestions(ctx.getContentResolver());
loadsImagesAutomatically = p.getBoolean("load_images",
loadsImagesAutomatically);
update();
}
- private void saveShowWebSuggestions(ContentResolver cr) {
- int value = showSearchSuggestions ? 1 : 0;
- Settings.System.putInt(cr, Settings.System.SHOW_WEB_SUGGESTIONS, value);
- }
-
- private void updateShowWebSuggestions(ContentResolver cr, SharedPreferences p) {
- showSearchSuggestions =
- Settings.System.getInt(cr,
- Settings.System.SHOW_WEB_SUGGESTIONS, 1) == 1;
- p.edit().putBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, showSearchSuggestions).commit();
- }
-
public String getHomePage() {
return homeUrl;
}
return searchEngine;
}
- public boolean getShowSearchSuggestions() {
- return showSearchSuggestions;
- }
-
public String getJsFlags() {
return jsFlags;
}