SettingsActivity.java revision 20f6c51ab018c45347bc99ccccb17f45cbfb9fc0
1/*
2 * Copyright (C) 2015 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.example.notificationshowcase;
18
19import android.app.Activity;
20import android.os.Bundle;
21import android.preference.PreferenceFragment;
22
23public class SettingsActivity extends Activity {
24    public static final String KEY_GLOBAL_FADE = "pref_key_global_fade";
25    public static final String KEY_SMS_ENABLE = "pref_key_sms_enable";
26    public static final String KEY_SMS_NOISY = "pref_key_sms_noisy";
27    public static final String KEY_SMS_BUZZY = "pref_key_sms_buzzy";
28    public static final String KEY_SMS_PRIORITY = "pref_key_sms_priority";
29    public static final String KEY_SMS_PERSON = "pref_key_sms_person";
30    public static final String KEY_PHONE_ENABLE = "pref_key_phone_enable";
31    public static final String KEY_PHONE_NOISY = "pref_key_phone_noisy";
32    public static final String KEY_PHONE_FULLSCREEN = "pref_key_phone_fullscreen";
33    public static final String KEY_PHONE_PERSON = "pref_key_phone_person";
34    public static final String KEY_UPLOAD_ENABLE = "pref_key_upload_enable";
35    public static final String KEY_TIMER_ENABLE = "pref_key_timer_enable";
36    public static final String KEY_CALENDAR_ENABLE = "pref_key_calendar_enable";
37    public static final String KEY_SOCIAL_ENABLE = "pref_key_social_enable";
38    public static final String KEY_INBOX_ENABLE = "pref_key_inbox_enable";
39    public static final String KEY_PICTURE_ENABLE = "pref_key_picture_enable";
40
41    public class SettingsFragment extends PreferenceFragment {
42        @Override
43        public void onCreate(Bundle savedInstanceState) {
44            super.onCreate(savedInstanceState);
45            addPreferencesFromResource(R.xml.preferences);
46        }
47    }
48
49    @Override
50    protected void onCreate(Bundle savedInstanceState) {
51        super.onCreate(savedInstanceState);
52        getFragmentManager().beginTransaction()
53                .replace(android.R.id.content, new SettingsFragment())
54                .commit();
55    }
56}
57