diff options
Diffstat (limited to 'src/com/android/browser/preferences')
7 files changed, 31 insertions, 44 deletions
diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java index 1f88e48..99bd687 100644 --- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java +++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java @@ -16,14 +16,13 @@ package com.android.browser.preferences; -import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import android.content.res.Resources; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceFragment; -import android.util.Log; import android.view.View; public class AccessibilityPreferencesFragment extends PreferenceFragment @@ -34,11 +33,11 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.accessibility_preferences); - Preference e = findPreference(BrowserSettings.PREF_TEXT_SIZE); + Preference e = findPreference(PreferenceKeys.PREF_TEXT_SIZE); e.setOnPreferenceChangeListener(this); e.setSummary(getVisualTextSizeName( getPreferenceScreen().getSharedPreferences() - .getString(BrowserSettings.PREF_TEXT_SIZE, null)) ); + .getString(PreferenceKeys.PREF_TEXT_SIZE, null)) ); } @Override @@ -55,7 +54,7 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment return false; } - if (pref.getKey().equals(BrowserSettings.PREF_TEXT_SIZE)) { + if (pref.getKey().equals(PreferenceKeys.PREF_TEXT_SIZE)) { pref.setSummary(getVisualTextSizeName((String) objValue)); return true; } diff --git a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java index 80db879..2cc504e 100644 --- a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java +++ b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java @@ -17,7 +17,7 @@ package com.android.browser.preferences; import com.android.browser.BrowserActivity; -import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import android.content.Intent; @@ -46,22 +46,22 @@ public class AdvancedPreferencesFragment extends PreferenceFragment addPreferencesFromResource(R.xml.advanced_preferences); PreferenceScreen websiteSettings = (PreferenceScreen) findPreference( - BrowserSettings.PREF_WEBSITE_SETTINGS); + PreferenceKeys.PREF_WEBSITE_SETTINGS); websiteSettings.setFragment(WebsiteSettingsFragment.class.getName()); - Preference e = findPreference(BrowserSettings.PREF_DEFAULT_ZOOM); + Preference e = findPreference(PreferenceKeys.PREF_DEFAULT_ZOOM); e.setOnPreferenceChangeListener(this); e.setSummary(getVisualDefaultZoomName( getPreferenceScreen().getSharedPreferences() - .getString(BrowserSettings.PREF_DEFAULT_ZOOM, null)) ); + .getString(PreferenceKeys.PREF_DEFAULT_ZOOM, null)) ); - e = findPreference(BrowserSettings.PREF_DEFAULT_TEXT_ENCODING); + e = findPreference(PreferenceKeys.PREF_DEFAULT_TEXT_ENCODING); e.setOnPreferenceChangeListener(this); - e = findPreference(BrowserSettings.PREF_EXTRAS_RESET_DEFAULTS); + e = findPreference(PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES); e.setOnPreferenceChangeListener(this); - e = findPreference(BrowserSettings.PREF_PLUGIN_STATE); + e = findPreference(PreferenceKeys.PREF_PLUGIN_STATE); e.setOnPreferenceChangeListener(this); updatePluginSummary((ListPreference) e); } @@ -79,7 +79,7 @@ public class AdvancedPreferencesFragment extends PreferenceFragment public void onResume() { super.onResume(); final PreferenceScreen websiteSettings = (PreferenceScreen) findPreference( - BrowserSettings.PREF_WEBSITE_SETTINGS); + PreferenceKeys.PREF_WEBSITE_SETTINGS); websiteSettings.setEnabled(false); WebStorage.getInstance().getOrigins(new ValueCallback<Map>() { @Override @@ -108,20 +108,20 @@ public class AdvancedPreferencesFragment extends PreferenceFragment return false; } - if (pref.getKey().equals(BrowserSettings.PREF_DEFAULT_ZOOM)) { + if (pref.getKey().equals(PreferenceKeys.PREF_DEFAULT_ZOOM)) { pref.setSummary(getVisualDefaultZoomName((String) objValue)); return true; - } else if (pref.getKey().equals(BrowserSettings.PREF_DEFAULT_TEXT_ENCODING)) { + } else if (pref.getKey().equals(PreferenceKeys.PREF_DEFAULT_TEXT_ENCODING)) { pref.setSummary((String) objValue); return true; - } else if (pref.getKey().equals(BrowserSettings.PREF_EXTRAS_RESET_DEFAULTS)) { + } else if (pref.getKey().equals(PreferenceKeys.PREF_RESET_DEFAULT_PREFERENCES)) { Boolean value = (Boolean) objValue; if (value.booleanValue() == true) { startActivity(new Intent(BrowserActivity.ACTION_RESTART, null, getActivity(), BrowserActivity.class)); return true; } - } else if (pref.getKey().equals(BrowserSettings.PREF_PLUGIN_STATE)) { + } else if (pref.getKey().equals(PreferenceKeys.PREF_PLUGIN_STATE)) { ListPreference lp = (ListPreference) pref; lp.setValue((String) objValue); updatePluginSummary(lp); diff --git a/src/com/android/browser/preferences/DebugPreferencesFragment.java b/src/com/android/browser/preferences/DebugPreferencesFragment.java index 0a82371..42b18cc 100644 --- a/src/com/android/browser/preferences/DebugPreferencesFragment.java +++ b/src/com/android/browser/preferences/DebugPreferencesFragment.java @@ -18,21 +18,14 @@ package com.android.browser.preferences; import com.android.browser.BrowserActivity; import com.android.browser.BrowserSettings; -import com.android.browser.Controller; +import com.android.browser.PreferenceKeys; import com.android.browser.R; -import android.content.Context; import android.content.Intent; -import android.os.AsyncTask; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceActivity.Header; import android.preference.PreferenceFragment; -import android.preference.PreferenceManager.OnActivityResultListener; - -import java.io.IOException; -import java.io.Serializable; public class DebugPreferencesFragment extends PreferenceFragment implements OnPreferenceChangeListener { @@ -43,11 +36,11 @@ public class DebugPreferencesFragment extends PreferenceFragment // Load the XML preferences file addPreferencesFromResource(R.xml.debug_preferences); - if (BrowserSettings.getInstance().showDebugSettings()) { + if (BrowserSettings.getInstance().isDebugEnabled()) { addPreferencesFromResource(R.xml.hidden_debug_preferences); } - Preference e = findPreference(BrowserSettings.PREF_HARDWARE_ACCEL); + Preference e = findPreference(PreferenceKeys.PREF_ENABLE_HARDWARE_ACCEL); e.setOnPreferenceChangeListener(this); } diff --git a/src/com/android/browser/preferences/GeneralPreferencesFragment.java b/src/com/android/browser/preferences/GeneralPreferencesFragment.java index 0c63ab5..879b95d 100644 --- a/src/com/android/browser/preferences/GeneralPreferencesFragment.java +++ b/src/com/android/browser/preferences/GeneralPreferencesFragment.java @@ -19,7 +19,7 @@ package com.android.browser.preferences; import com.android.browser.BrowserBookmarksPage; import com.android.browser.BrowserHomepagePreference; import com.android.browser.BrowserPreferencesPage; -import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import com.android.browser.widget.BookmarkThumbnailWidgetProvider; @@ -62,10 +62,10 @@ public class GeneralPreferencesFragment extends PreferenceFragment // Load the XML preferences file addPreferencesFromResource(R.xml.general_preferences); - Preference e = findPreference(BrowserSettings.PREF_HOMEPAGE); + Preference e = findPreference(PreferenceKeys.PREF_HOMEPAGE); e.setOnPreferenceChangeListener(this); e.setSummary(getPreferenceScreen().getSharedPreferences() - .getString(BrowserSettings.PREF_HOMEPAGE, null)); + .getString(PreferenceKeys.PREF_HOMEPAGE, null)); ((BrowserHomepagePreference) e).setCurrentPage( getActivity().getIntent().getStringExtra(BrowserPreferencesPage.CURRENT_PAGE)); mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); @@ -81,7 +81,7 @@ public class GeneralPreferencesFragment extends PreferenceFragment return false; } - if (pref.getKey().equals(BrowserSettings.PREF_HOMEPAGE)) { + if (pref.getKey().equals(PreferenceKeys.PREF_HOMEPAGE)) { pref.setSummary((String) objValue); return true; } @@ -202,8 +202,8 @@ public class GeneralPreferencesFragment extends PreferenceFragment new GetAccountsTask(getActivity()).execute(); PreferenceScreen autoFillSettings = - (PreferenceScreen)findPreference(BrowserSettings.PREF_AUTOFILL_PROFILE); - autoFillSettings.setDependency(BrowserSettings.PREF_AUTOFILL_ENABLED); + (PreferenceScreen)findPreference(PreferenceKeys.PREF_AUTOFILL_PROFILE); + autoFillSettings.setDependency(PreferenceKeys.PREF_AUTOFILL_ENABLED); } @Override diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java index 88a9690..f99b96d 100644 --- a/src/com/android/browser/preferences/LabPreferencesFragment.java +++ b/src/com/android/browser/preferences/LabPreferencesFragment.java @@ -18,6 +18,7 @@ package com.android.browser.preferences; import com.android.browser.BrowserActivity; import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import com.android.browser.search.SearchEngine; @@ -41,11 +42,11 @@ public class LabPreferencesFragment extends PreferenceFragment // Load the XML preferences file addPreferencesFromResource(R.xml.lab_preferences); - Preference e = findPreference(BrowserSettings.PREF_QUICK_CONTROLS); + Preference e = findPreference(PreferenceKeys.PREF_ENABLE_QUICK_CONTROLS); if (e != null) { e.setOnPreferenceChangeListener(this); } - useInstantPref = findPreference(BrowserSettings.PREF_USE_INSTANT); + useInstantPref = findPreference(PreferenceKeys.PREF_USE_INSTANT_SEARCH); } @Override diff --git a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java index 2266608..35e6e43 100644 --- a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java +++ b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java @@ -16,7 +16,7 @@ package com.android.browser.preferences; -import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import android.app.Activity; @@ -28,18 +28,14 @@ import android.preference.PreferenceFragment; public class PrivacySecurityPreferencesFragment extends PreferenceFragment implements Preference.OnPreferenceChangeListener { - private BrowserSettings mSettings; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mSettings = BrowserSettings.getInstance(); - // Load the preferences from an XML resource addPreferencesFromResource(R.xml.privacy_security_preferences); - Preference e = findPreference(BrowserSettings.PREF_CLEAR_HISTORY); + Preference e = findPreference(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY); e.setOnPreferenceChangeListener(this); } @@ -50,7 +46,7 @@ public class PrivacySecurityPreferencesFragment extends PreferenceFragment @Override public boolean onPreferenceChange(Preference pref, Object objValue) { - if (pref.getKey().equals(BrowserSettings.PREF_CLEAR_HISTORY) + if (pref.getKey().equals(PreferenceKeys.PREF_PRIVACY_CLEAR_HISTORY) && ((Boolean) objValue).booleanValue() == true) { // Need to tell the browser to remove the parent/child relationship // between tabs diff --git a/src/com/android/browser/preferences/WebViewPreview.java b/src/com/android/browser/preferences/WebViewPreview.java index 15dc83a..94598bc 100644 --- a/src/com/android/browser/preferences/WebViewPreview.java +++ b/src/com/android/browser/preferences/WebViewPreview.java @@ -66,8 +66,6 @@ public class WebViewPreview extends Preference implements OnSharedPreferenceChan void updatePreview() { if (mWebView == null) return; - BrowserSettings.getInstance().syncSharedPreferences(getContext(), - PreferenceManager.getDefaultSharedPreferences(getContext())); WebSettings ws = mWebView.getSettings(); BrowserSettings bs = BrowserSettings.getInstance(); ws.setMinimumFontSize(bs.getMinimumFontSize()); |