OSDN Git Service

Remove "Show web suggestions" from browser settings
authorLeon Scroggins III <scroggo@google.com>
Fri, 17 Sep 2010 17:01:13 +0000 (13:01 -0400)
committerLeon Scroggins III <scroggo@google.com>
Fri, 17 Sep 2010 17:52:00 +0000 (13:52 -0400)
Bug:3011374
Change-Id: I44d57431d127e48d25a957915a2fb93dc96b1053

res/values/strings.xml
res/xml/browser_preferences.xml
src/com/android/browser/BrowserProvider.java
src/com/android/browser/BrowserSettings.java

index f852167..3eb9a7e 100644 (file)
     <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 -->
index 501d8c1..1da85ec 100644 (file)
                     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"
index 96745e5..6c9a769 100644 (file)
@@ -821,7 +821,6 @@ public class BrowserProvider extends ContentProvider {
             } else {
                 // get search suggestions if there is still space in the list
                 if (myArgs != null && myArgs.length > 1
-                        && mSettings.getShowSearchSuggestions()
                         && c.getCount() < (MAX_SUGGESTION_SHORT_ENTRIES - 1)) {
                     SearchEngine searchEngine = mSettings.getSearchEngine();
                     if (searchEngine != null && searchEngine.supportsSuggestions()) {
index a51c773..71777d6 100644 (file)
@@ -80,7 +80,6 @@ class BrowserSettings extends Observable {
     private String defaultTextEncodingName;
     private String homeUrl = "";
     private SearchEngine searchEngine;
-    private boolean showSearchSuggestions;
     private boolean autoFitPage;
     private boolean landscapeOnly;
     private boolean loadsPageInOverviewMode;
@@ -132,7 +131,6 @@ class BrowserSettings extends Observable {
     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 =
@@ -278,19 +276,6 @@ class BrowserSettings extends Observable {
             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
@@ -319,9 +304,6 @@ class BrowserSettings extends Observable {
             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);
@@ -410,18 +392,6 @@ class BrowserSettings extends Observable {
         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;
     }
@@ -430,10 +400,6 @@ class BrowserSettings extends Observable {
         return searchEngine;
     }
 
-    public boolean getShowSearchSuggestions() {
-        return showSearchSuggestions;
-    }
-
     public String getJsFlags() {
         return jsFlags;
     }