diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-12-31 20:15:03 +0100 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2015-12-29 23:41:25 +0100 |
commit | 8a1ee129648d871d3720529a0032b0c6b15810a7 (patch) | |
tree | cc0fb3e1f439e2ebe7c08dccc41f0af43a80961c | |
parent | ad614da6fd8a6c85ac98bd27d92e2801098e2bf6 (diff) | |
download | packages_apps_Browser-8a1ee129648d871d3720529a0032b0c6b15810a7.zip packages_apps_Browser-8a1ee129648d871d3720529a0032b0c6b15810a7.tar.gz packages_apps_Browser-8a1ee129648d871d3720529a0032b0c6b15810a7.tar.bz2 |
Show search suggestions only when enabled in preferences
Change-Id: I6d6cd753f1bdffa6aecd078db62b1bbc08e95aa7
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-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()); |