diff options
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | res/xml/privacy_security_preferences.xml | 6 | ||||
-rw-r--r-- | src/com/android/browser/BrowserSettings.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/PreferenceKeys.java | 1 | ||||
-rw-r--r-- | src/com/android/browser/SuggestionsAdapter.java | 8 |
5 files changed, 22 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index d79c7f7..f5d3d26 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -487,6 +487,10 @@ <!-- Settings summmary --> <string name="pref_security_show_security_warning_summary">Show warning if there\'s a problem with a site\'s security</string> <!-- Settings label --> + <string name="pref_security_show_search_suggestions">Show search suggestions</string> + <!-- Settings summmary --> + <string name="pref_security_show_search_suggestions_summary">Show search suggestions when typing in the URL field</string> + <!-- Settings label --> <string name="pref_security_accept_cookies">Accept cookies</string> <!-- Settings summary --> <string name="pref_security_accept_cookies_summary">Allow sites to save and read cookie data</string> diff --git a/res/xml/privacy_security_preferences.xml b/res/xml/privacy_security_preferences.xml index 2633600..a574e61 100644 --- a/res/xml/privacy_security_preferences.xml +++ b/res/xml/privacy_security_preferences.xml @@ -37,6 +37,12 @@ android:title="@string/pref_security_show_security_warning" android:summary="@string/pref_security_show_security_warning_summary" /> + <CheckBoxPreference + android:key="show_search_suggestions" + android:defaultValue="false" + android:title="@string/pref_security_show_search_suggestions" + android:summary="@string/pref_security_show_search_suggestions_summary" /> + <PreferenceCategory android:title="@string/pref_privacy_cookies_title"> <CheckBoxPreference android:key="accept_cookies" diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index e76fa5d..defa5da 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -797,6 +797,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, return mPrefs.getBoolean(PREF_SHOW_SECURITY_WARNINGS, true); } + public boolean showSearchSuggestions() { + return mPrefs.getBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, false); + } + public boolean acceptCookies() { return mPrefs.getBoolean(PREF_ACCEPT_COOKIES, true); } diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java index 3bb2438..ec99f4f 100644 --- a/src/com/android/browser/PreferenceKeys.java +++ b/src/com/android/browser/PreferenceKeys.java @@ -99,6 +99,7 @@ public interface PreferenceKeys { static final String PREF_REMEMBER_PASSWORDS = "remember_passwords"; static final String PREF_SAVE_FORMDATA = "save_formdata"; static final String PREF_SHOW_SECURITY_WARNINGS = "show_security_warnings"; + static final String PREF_SHOW_SEARCH_SUGGESTIONS = "show_search_suggestions"; // ---------------------- // Keys for bandwidth_preferences.xml diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java index 62fa0bc..a759e23 100644 --- a/src/com/android/browser/SuggestionsAdapter.java +++ b/src/com/android/browser/SuggestionsAdapter.java @@ -202,9 +202,15 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, @Override protected List<SuggestItem> doInBackground(CharSequence... params) { + List<SuggestItem> results = new ArrayList<SuggestItem>(); + + // Don't query the search engine if disabled in settings + if (!mSettings.showSearchSuggestions()) { + return results; + } + SuggestCursor cursor = new SuggestCursor(); cursor.runQuery(params[0]); - List<SuggestItem> results = new ArrayList<SuggestItem>(); int count = cursor.getCount(); for (int i = 0; i < count; i++) { results.add(cursor.getItem()); |