11461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb/* 21461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * Copyright (C) 2011 The Android Open Source Project 31461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * 41461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * Licensed under the Apache License, Version 2.0 (the "License"); 51461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * you may not use this file except in compliance with the License. 61461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * You may obtain a copy of the License at 71461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * 81461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * http://www.apache.org/licenses/LICENSE-2.0 91461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * 101461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * Unless required by applicable law or agreed to in writing, software 111461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * distributed under the License is distributed on an "AS IS" BASIS, 121461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * See the License for the specific language governing permissions and 141461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb * limitations under the License 151461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb */ 161461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 171461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbpackage com.android.browser.preferences; 181461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 191461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbimport android.os.Bundle; 20825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwoodimport android.preference.ListPreference; 211461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbimport android.preference.PreferenceFragment; 221461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 23825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwoodimport com.android.browser.BrowserSettings; 241461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbimport com.android.browser.PreferenceKeys; 251461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbimport com.android.browser.R; 261461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 271461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbpublic class BandwidthPreferencesFragment extends PreferenceFragment { 281461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 291461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb static final String TAG = "BandwidthPreferencesFragment"; 301461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 311461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb @Override 321461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb public void onCreate(Bundle savedInstanceState) { 331461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb super.onCreate(savedInstanceState); 341461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb // Load the XML preferences file 351461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb addPreferencesFromResource(R.xml.bandwidth_preferences); 361461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb } 371461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 38825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood @Override 39825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood public void onResume() { 40825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood super.onResume(); 41825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood if (!getPreferenceScreen().getSharedPreferences() 42825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood .contains(PreferenceKeys.PREF_DATA_PRELOAD)) { 43825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood // set default value for preload setting 44825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood ListPreference preload = (ListPreference) getPreferenceScreen().findPreference( 45825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood PreferenceKeys.PREF_DATA_PRELOAD); 46825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood if (preload != null) { 47825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood preload.setValue(BrowserSettings.getInstance().getDefaultPreloadSetting()); 48825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood } 49825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood } 50825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood } 51825fba7eb4dae7911f84d8a48a662c4cd6a4db1fMathew Inwood 521461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb} 53