• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.browser.preferences;
18 
19 import android.os.Bundle;
20 import android.preference.ListPreference;
21 import android.preference.PreferenceFragment;
22 
23 import com.android.browser.BrowserSettings;
24 import com.android.browser.PreferenceKeys;
25 import com.android.browser.R;
26 
27 public class BandwidthPreferencesFragment extends PreferenceFragment {
28 
29     static final String TAG = "BandwidthPreferencesFragment";
30 
31     @Override
onCreate(Bundle savedInstanceState)32     public void onCreate(Bundle savedInstanceState) {
33         super.onCreate(savedInstanceState);
34         // Load the XML preferences file
35         addPreferencesFromResource(R.xml.bandwidth_preferences);
36     }
37 
38     @Override
onResume()39     public void onResume() {
40         super.onResume();
41         if (!getPreferenceScreen().getSharedPreferences()
42                 .contains(PreferenceKeys.PREF_DATA_PRELOAD)) {
43             // set default value for preload setting
44             ListPreference preload = (ListPreference) getPreferenceScreen().findPreference(
45                     PreferenceKeys.PREF_DATA_PRELOAD);
46             if (preload != null) {
47                 preload.setValue(BrowserSettings.getInstance().getDefaultPreloadSetting());
48             }
49         }
50     }
51 
52 }
53