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.calendar; 18 19 import android.content.ComponentName; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.preference.Preference; 23 import android.preference.PreferenceFragment; 24 import android.preference.PreferenceScreen; 25 26 public class OtherPreferences extends PreferenceFragment { 27 // The name of the shared preferences file. This name must be maintained for 28 // historical reasons, as it's what PreferenceManager assigned the first 29 // time the file was created. 30 static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; 31 32 public static final String KEY_OTHER_1 = "preferences_tardis_1"; 33 34 private Preference mCopyDb; 35 36 public OtherPreferences() { 37 } 38 39 @Override 40 public void onCreate(Bundle icicle) { 41 super.onCreate(icicle); 42 getPreferenceManager().setSharedPreferencesName(SHARED_PREFS_NAME); 43 addPreferencesFromResource(R.xml.other_preferences); 44 mCopyDb = findPreference("preferences_copy_db"); 45 } 46 47 @Override 48 public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { 49 if (preference == mCopyDb) { 50 Intent intent = new Intent(Intent.ACTION_MAIN); 51 intent.setComponent(new ComponentName("com.android.providers.calendar", 52 "com.android.providers.calendar.CalendarDebugActivity")); 53 startActivity(intent); 54 } else { 55 return super.onPreferenceTreeClick(screen, preference); 56 } 57 return true; 58 } 59 }