From 825fba7eb4dae7911f84d8a48a662c4cd6a4db1f Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Tue, 4 Oct 2011 14:52:52 +0100 Subject: Allow default preload setting to be configured via Gservices. We now load the default value from a secure setting. To over-ride it, set Gservices key secure:browser_default_preload_setting to the appropriate value. The Gservices default value will only be used if the user has never opened the 'Bandwidth management' tab in the browswer settings. Once that tab has been opened, even if the user did not change the setting, the value will be persisted in the browser and the default will be ignored. Bug: 5346028 Change-Id: If3b14485dc8bc46e7ed72c49eb5cf3c474893fe3 --- .../preferences/BandwidthPreferencesFragment.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/com/android/browser/preferences') diff --git a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java index 18b9fa49b..2c147ccba 100644 --- a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java +++ b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java @@ -16,12 +16,11 @@ package com.android.browser.preferences; -import android.content.res.Resources; import android.os.Bundle; -import android.preference.Preference; +import android.preference.ListPreference; import android.preference.PreferenceFragment; -import android.util.Log; +import com.android.browser.BrowserSettings; import com.android.browser.PreferenceKeys; import com.android.browser.R; @@ -36,4 +35,18 @@ public class BandwidthPreferencesFragment extends PreferenceFragment { addPreferencesFromResource(R.xml.bandwidth_preferences); } + @Override + public void onResume() { + super.onResume(); + if (!getPreferenceScreen().getSharedPreferences() + .contains(PreferenceKeys.PREF_DATA_PRELOAD)) { + // set default value for preload setting + ListPreference preload = (ListPreference) getPreferenceScreen().findPreference( + PreferenceKeys.PREF_DATA_PRELOAD); + if (preload != null) { + preload.setValue(BrowserSettings.getInstance().getDefaultPreloadSetting()); + } + } + } + } -- cgit v1.2.3