1/*
2 * Copyright (C) 2010 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
17package com.android.browser.preferences;
18
19import android.os.Bundle;
20import android.preference.Preference;
21import android.preference.Preference.OnPreferenceClickListener;
22import android.preference.PreferenceFragment;
23
24import com.android.browser.BrowserSettings;
25import com.android.browser.GoogleAccountLogin;
26import com.android.browser.PreferenceKeys;
27import com.android.browser.R;
28
29public class DebugPreferencesFragment extends PreferenceFragment
30        implements OnPreferenceClickListener {
31    @Override
32    public void onCreate(Bundle savedInstanceState) {
33        super.onCreate(savedInstanceState);
34
35        // Load the XML preferences file
36        addPreferencesFromResource(R.xml.debug_preferences);
37
38        Preference e = findPreference(PreferenceKeys.PREF_RESET_PRELOGIN);
39        e.setOnPreferenceClickListener(this);
40    }
41
42    @Override
43    public boolean onPreferenceClick(Preference preference) {
44        if (PreferenceKeys.PREF_RESET_PRELOGIN.equals(preference.getKey())) {
45            BrowserSettings.getInstance().getPreferences().edit()
46                    .remove(GoogleAccountLogin.PREF_AUTOLOGIN_TIME)
47                    .apply();
48            return true;
49        }
50        return false;
51    }
52}
53