summaryrefslogtreecommitdiffstats
path: root/src/com/android/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/calendar')
-rw-r--r--src/com/android/calendar/AllInOneActivity.java12
-rw-r--r--src/com/android/calendar/CalendarApplication.java2
-rw-r--r--src/com/android/calendar/CalendarController.java6
-rw-r--r--src/com/android/calendar/CalendarEventModel.java4
-rw-r--r--src/com/android/calendar/CalendarSettingsActivity.java28
-rw-r--r--src/com/android/calendar/Event.java4
-rw-r--r--src/com/android/calendar/EventInfoFragment.java4
-rw-r--r--src/com/android/calendar/GeneralPreferences.java (renamed from src/com/android/calendar/CalendarPreferenceActivity.java)27
-rw-r--r--src/com/android/calendar/TimezoneAdapter.java4
-rw-r--r--src/com/android/calendar/Utils.java44
-rw-r--r--src/com/android/calendar/agenda/AgendaFragment.java6
-rw-r--r--src/com/android/calendar/alerts/AlertService.java18
-rw-r--r--src/com/android/calendar/event/EditEventView.java10
13 files changed, 101 insertions, 68 deletions
diff --git a/src/com/android/calendar/AllInOneActivity.java b/src/com/android/calendar/AllInOneActivity.java
index d6f4981a..c3c6579a 100644
--- a/src/com/android/calendar/AllInOneActivity.java
+++ b/src/com/android/calendar/AllInOneActivity.java
@@ -105,7 +105,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
initFragments(timeMillis, viewType);
// Listen for changes that would require this to be refreshed
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(this);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this);
mContentResolver = getContentResolver();
}
@@ -137,7 +137,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
protected void onDestroy() {
super.onDestroy();
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(this);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
prefs.unregisterOnSharedPreferenceChangeListener(this);
CalendarController.removeInstance(this);
}
@@ -160,9 +160,9 @@ public class AllInOneActivity extends Activity implements EventHandler,
EventInfo info = null;
if (viewType == ViewType.EDIT) {
- mPreviousView = CalendarPreferenceActivity.getSharedPreferences(this).getInt(
- CalendarPreferenceActivity.KEY_START_VIEW,
- CalendarPreferenceActivity.DEFAULT_START_VIEW);
+ mPreviousView = GeneralPreferences.getSharedPreferences(this).getInt(
+ GeneralPreferences.KEY_START_VIEW,
+ GeneralPreferences.DEFAULT_START_VIEW);
int eventId = -1;
Intent intent = getIntent();
@@ -266,7 +266,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
- if (key.equals(CalendarPreferenceActivity.KEY_WEEK_START_DAY)) {
+ if (key.equals(GeneralPreferences.KEY_WEEK_START_DAY)) {
initFragments(mController.getTime(), mController.getViewType());
}
}
diff --git a/src/com/android/calendar/CalendarApplication.java b/src/com/android/calendar/CalendarApplication.java
index 6459c1e6..d0ca4698 100644
--- a/src/com/android/calendar/CalendarApplication.java
+++ b/src/com/android/calendar/CalendarApplication.java
@@ -27,6 +27,6 @@ public class CalendarApplication extends Application {
* Ensure the default values are set for any receiver, activity,
* service, etc. of Calendar
*/
- CalendarPreferenceActivity.setDefaultValues(this);
+ GeneralPreferences.setDefaultValues(this);
}
}
diff --git a/src/com/android/calendar/CalendarController.java b/src/com/android/calendar/CalendarController.java
index bf4e2691..59d55195 100644
--- a/src/com/android/calendar/CalendarController.java
+++ b/src/com/android/calendar/CalendarController.java
@@ -183,8 +183,8 @@ public class CalendarController {
mContext = context;
mTime.setToNow();
mDetailViewType = Utils.getSharedPreference(mContext,
- CalendarPreferenceActivity.KEY_DETAILED_VIEW,
- CalendarPreferenceActivity.DEFAULT_DETAILED_VIEW);
+ GeneralPreferences.KEY_DETAILED_VIEW,
+ GeneralPreferences.DEFAULT_DETAILED_VIEW);
mService = new AsyncQueryService(context) {
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
@@ -394,7 +394,7 @@ public class CalendarController {
private void launchSettings() {
Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setClassName(mContext, CalendarPreferenceActivity.class.getName());
+ intent.setClassName(mContext, CalendarSettingsActivity.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mContext.startActivity(intent);
}
diff --git a/src/com/android/calendar/CalendarEventModel.java b/src/com/android/calendar/CalendarEventModel.java
index 7af45fde..3d382bde 100644
--- a/src/com/android/calendar/CalendarEventModel.java
+++ b/src/com/android/calendar/CalendarEventModel.java
@@ -134,8 +134,8 @@ public class CalendarEventModel {
public CalendarEventModel(Context context) {
this();
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
- String defaultReminder = prefs.getString(CalendarPreferenceActivity.KEY_DEFAULT_REMINDER,
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
+ String defaultReminder = prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER,
"0");
int defaultReminderMins = Integer.parseInt(defaultReminder);
if (defaultReminderMins != 0) {
diff --git a/src/com/android/calendar/CalendarSettingsActivity.java b/src/com/android/calendar/CalendarSettingsActivity.java
new file mode 100644
index 00000000..8851bf24
--- /dev/null
+++ b/src/com/android/calendar/CalendarSettingsActivity.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.calendar;
+
+import android.preference.PreferenceActivity;
+
+import java.util.List;
+
+public class CalendarSettingsActivity extends PreferenceActivity {
+ @Override
+ public void onBuildHeaders(List<Header> target) {
+ loadHeadersFromResource(R.xml.calendar_settings_headers, target);
+ }
+} \ No newline at end of file
diff --git a/src/com/android/calendar/Event.java b/src/com/android/calendar/Event.java
index 32a6131b..0a84ad04 100644
--- a/src/com/android/calendar/Event.java
+++ b/src/com/android/calendar/Event.java
@@ -294,8 +294,8 @@ public class Event implements Comparable<Event>, Cloneable {
String orderBy = Instances.SORT_CALENDAR_VIEW;
// Respect the preference to show/hide declined events
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
- boolean hideDeclined = prefs.getBoolean(CalendarPreferenceActivity.KEY_HIDE_DECLINED,
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
+ boolean hideDeclined = prefs.getBoolean(GeneralPreferences.KEY_HIDE_DECLINED,
false);
String where = null;
diff --git a/src/com/android/calendar/EventInfoFragment.java b/src/com/android/calendar/EventInfoFragment.java
index d50cba79..d1fc5e5c 100644
--- a/src/com/android/calendar/EventInfoFragment.java
+++ b/src/com/android/calendar/EventInfoFragment.java
@@ -525,9 +525,9 @@ public class EventInfoFragment extends DialogFragment implements View.OnClickLis
String[] labels = r.getStringArray(R.array.reminder_minutes_labels);
mReminderLabels = new ArrayList<String>(Arrays.asList(labels));
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(getActivity());
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(getActivity());
String durationString =
- prefs.getString(CalendarPreferenceActivity.KEY_DEFAULT_REMINDER, "0");
+ prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER, "0");
mDefaultReminderMinutes = Integer.parseInt(durationString);
// Setup the + Add Reminder Button
diff --git a/src/com/android/calendar/CalendarPreferenceActivity.java b/src/com/android/calendar/GeneralPreferences.java
index 7d69f98e..bc0c98e4 100644
--- a/src/com/android/calendar/CalendarPreferenceActivity.java
+++ b/src/com/android/calendar/GeneralPreferences.java
@@ -16,6 +16,7 @@
package com.android.calendar;
+import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@@ -26,14 +27,14 @@ import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
import android.provider.SearchRecentSuggestions;
import android.widget.Toast;
-public class CalendarPreferenceActivity extends PreferenceActivity implements
+public class GeneralPreferences extends PreferenceFragment implements
OnSharedPreferenceChangeListener, OnPreferenceChangeListener {
private static final String BUILD_VERSION = "build_version";
@@ -104,13 +105,15 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
}
@Override
- protected void onCreate(Bundle icicle) {
+ public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ final Activity activity = getActivity();
+
// Make sure to always use the same preferences file regardless of the package name
// we're running under
- PreferenceManager preferenceManager = getPreferenceManager();
- SharedPreferences sharedPreferences = getSharedPreferences(this);
+ final PreferenceManager preferenceManager = getPreferenceManager();
+ final SharedPreferences sharedPreferences = getSharedPreferences(activity);
preferenceManager.setSharedPreferencesName(SHARED_PREFS_NAME);
// Load the preferences from an XML resource
@@ -131,7 +134,8 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
migrateOldPreferences(sharedPreferences);
try {
- PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
+ final PackageInfo packageInfo =
+ activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0);
findPreference(BUILD_VERSION).setSummary(packageInfo.versionName);
} catch (NameNotFoundException e) {
findPreference(BUILD_VERSION).setSummary("?");
@@ -165,7 +169,7 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
} else {
return false;
}
- Utils.setTimeZone(this, tz);
+ Utils.setTimeZone(getActivity(), tz);
return true;
}
@@ -181,7 +185,7 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
int stringId = prefs.getBoolean(KEY_ALERTS_VIBRATE, false) ?
R.string.prefDefault_alerts_vibrate_true :
R.string.prefDefault_alerts_vibrate_false;
- mVibrateWhen.setValue(getString(stringId));
+ mVibrateWhen.setValue(getActivity().getString(stringId));
}
// If needed, migrate the old alerts type settin
if (!prefs.contains(KEY_ALERTS) && prefs.contains(KEY_ALERTS_TYPE)) {
@@ -215,7 +219,8 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
mRingtone.setEnabled(true);
mPopup.setEnabled(true);
} else {
- mVibrateWhen.setValue(getString(R.string.prefDefault_alerts_vibrate_false));
+ mVibrateWhen.setValue(
+ getActivity().getString(R.string.prefDefault_alerts_vibrate_false));
mVibrateWhen.setEnabled(false);
mRingtone.setEnabled(false);
mPopup.setEnabled(false);
@@ -227,11 +232,11 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
String key = preference.getKey();
if (key.equals(KEY_CLEAR_SEARCH_HISTORY)) {
- SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
+ SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getActivity(),
CalendarRecentSuggestionsProvider.AUTHORITY,
CalendarRecentSuggestionsProvider.MODE);
suggestions.clearHistory();
- Toast.makeText(this, R.string.search_history_cleared,
+ Toast.makeText(getActivity(), R.string.search_history_cleared,
Toast.LENGTH_SHORT).show();
return true;
}
diff --git a/src/com/android/calendar/TimezoneAdapter.java b/src/com/android/calendar/TimezoneAdapter.java
index 48cb9953..694b659a 100644
--- a/src/com/android/calendar/TimezoneAdapter.java
+++ b/src/com/android/calendar/TimezoneAdapter.java
@@ -233,7 +233,7 @@ public class TimezoneAdapter extends ArrayAdapter<TimezoneRow> {
ids.add(TimeZone.getDefault().getID());
// add in recent timezone selections
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(mContext);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(mContext);
String recentsString = prefs.getString(KEY_RECENT_TIMEZONES, null);
if (recentsString != null) {
String[] recents = recentsString.split(RECENT_TIMEZONES_DELIMITER);
@@ -297,7 +297,7 @@ public class TimezoneAdapter extends ArrayAdapter<TimezoneRow> {
* @see {@link #MAX_RECENT_TIMEZONES}
*/
public void saveRecentTimezone(String id) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(mContext);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(mContext);
String recentsString = prefs.getString(KEY_RECENT_TIMEZONES, null);
List<String> recents;
if (recentsString == null) {
diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java
index 44a2b04c..9c800a07 100644
--- a/src/com/android/calendar/Utils.java
+++ b/src/com/android/calendar/Utils.java
@@ -88,7 +88,7 @@ public class Utils {
public static int getViewTypeFromIntentAndSharedPref(Activity activity) {
Intent intent = activity.getIntent();
Bundle extras = intent.getExtras();
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(activity);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(activity);
if (TextUtils.equals(intent.getAction(),Intent.ACTION_EDIT)) {
return ViewType.EDIT;
@@ -96,8 +96,8 @@ public class Utils {
if (extras != null) {
if (extras.getBoolean(INTENT_KEY_DETAIL_VIEW, false)) {
// This is the "detail" view which is either agenda or day view
- return prefs.getInt(CalendarPreferenceActivity.KEY_DETAILED_VIEW,
- CalendarPreferenceActivity.DEFAULT_DETAILED_VIEW);
+ return prefs.getInt(GeneralPreferences.KEY_DETAILED_VIEW,
+ GeneralPreferences.DEFAULT_DETAILED_VIEW);
} else if (INTENT_VALUE_VIEW_TYPE_DAY.equals(extras.getString(INTENT_KEY_VIEW_TYPE))) {
// Not sure who uses this. This logic came from LaunchActivity
return ViewType.DAY;
@@ -105,8 +105,8 @@ public class Utils {
}
// Default to the last view
- return prefs.getInt(CalendarPreferenceActivity.KEY_START_VIEW,
- CalendarPreferenceActivity.DEFAULT_START_VIEW);
+ return prefs.getInt(GeneralPreferences.KEY_START_VIEW,
+ GeneralPreferences.DEFAULT_START_VIEW);
}
/**
@@ -128,7 +128,7 @@ public class Utils {
}
boolean updatePrefs = false;
synchronized (mTZCallbacks) {
- if (CalendarPreferenceActivity.LOCAL_TZ.equals(timeZone)) {
+ if (GeneralPreferences.LOCAL_TZ.equals(timeZone)) {
if (mUseHomeTZ) {
updatePrefs = true;
}
@@ -142,9 +142,9 @@ public class Utils {
}
}
if (updatePrefs) {
- setSharedPreference(context, CalendarPreferenceActivity.KEY_HOME_TZ_ENABLED,
+ setSharedPreference(context, GeneralPreferences.KEY_HOME_TZ_ENABLED,
mUseHomeTZ);
- setSharedPreference(context, CalendarPreferenceActivity.KEY_HOME_TZ, mHomeTZ);
+ setSharedPreference(context, GeneralPreferences.KEY_HOME_TZ, mHomeTZ);
}
// TODO async update db
}
@@ -169,11 +169,11 @@ public class Utils {
mTZQueryInProgress = true;
mFirstTZRequest = false;
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
mUseHomeTZ = prefs.getBoolean(
- CalendarPreferenceActivity.KEY_HOME_TZ_ENABLED, false);
+ GeneralPreferences.KEY_HOME_TZ_ENABLED, false);
mHomeTZ = prefs.getString(
- CalendarPreferenceActivity.KEY_HOME_TZ, Time.getCurrentTimezone());
+ GeneralPreferences.KEY_HOME_TZ, Time.getCurrentTimezone());
// TODO kick off async query
// When the async query returns it should synchronize on
// mTZCallbacks, update mUseHomeTZ, mHomeTZ, and the
@@ -190,7 +190,7 @@ public class Utils {
}
public static String getSharedPreference(Context context, String key, String defaultValue) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
return prefs.getString(key, defaultValue);
}
@@ -216,7 +216,7 @@ public class Utils {
}
public static int getSharedPreference(Context context, String key, int defaultValue) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
return prefs.getInt(key, defaultValue);
}
@@ -228,12 +228,12 @@ public class Utils {
* @param value the value to set
*/
public static void setSharedPreference(Context context, String key, String value) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
prefs.edit().putString(key, value).apply();
}
static void setSharedPreference(Context context, String key, boolean value) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(key, value);
editor.apply();
@@ -246,17 +246,17 @@ public class Utils {
* @param viewId {@link CalendarController.ViewType}
*/
static void setDefaultView(Context context, int viewId) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
if (viewId == CalendarController.ViewType.AGENDA
|| viewId == CalendarController.ViewType.DAY) {
// Record the (new) detail start view only for Agenda and Day
- editor.putInt(CalendarPreferenceActivity.KEY_DETAILED_VIEW, viewId);
+ editor.putInt(GeneralPreferences.KEY_DETAILED_VIEW, viewId);
}
// Record the (new) start view
- editor.putInt(CalendarPreferenceActivity.KEY_START_VIEW, viewId);
+ editor.putInt(GeneralPreferences.KEY_START_VIEW, viewId);
editor.apply();
}
@@ -391,12 +391,12 @@ public class Utils {
* @return the first day of week in android.text.format.Time
*/
public static int getFirstDayOfWeek(Context context) {
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
- String pref = prefs.getString(CalendarPreferenceActivity.KEY_WEEK_START_DAY,
- CalendarPreferenceActivity.WEEK_START_DEFAULT);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
+ String pref = prefs.getString(GeneralPreferences.KEY_WEEK_START_DAY,
+ GeneralPreferences.WEEK_START_DEFAULT);
int startDay;
- if (CalendarPreferenceActivity.WEEK_START_DEFAULT.equals(pref)) {
+ if (GeneralPreferences.WEEK_START_DEFAULT.equals(pref)) {
startDay = Calendar.getInstance().getFirstDayOfWeek();
} else {
startDay = Integer.parseInt(pref);
diff --git a/src/com/android/calendar/agenda/AgendaFragment.java b/src/com/android/calendar/agenda/AgendaFragment.java
index a3db52fb..01bc67b5 100644
--- a/src/com/android/calendar/agenda/AgendaFragment.java
+++ b/src/com/android/calendar/agenda/AgendaFragment.java
@@ -29,7 +29,7 @@ import android.view.ViewGroup;
import com.android.calendar.CalendarController;
import com.android.calendar.CalendarController.EventInfo;
import com.android.calendar.CalendarController.EventType;
-import com.android.calendar.CalendarPreferenceActivity;
+import com.android.calendar.GeneralPreferences;
import dalvik.system.VMRuntime;
@@ -83,10 +83,10 @@ public class AgendaFragment extends Fragment implements CalendarController.Event
Log.v(TAG, "OnResume to " + mTime.toString());
}
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(
getActivity());
boolean hideDeclined = prefs.getBoolean(
- CalendarPreferenceActivity.KEY_HIDE_DECLINED, false);
+ GeneralPreferences.KEY_HIDE_DECLINED, false);
mAgendaListView.setHideDeclinedEvents(hideDeclined);
mAgendaListView.goTo(mTime, mQuery, true);
diff --git a/src/com/android/calendar/alerts/AlertService.java b/src/com/android/calendar/alerts/AlertService.java
index cbfd9f98..54a15f92 100644
--- a/src/com/android/calendar/alerts/AlertService.java
+++ b/src/com/android/calendar/alerts/AlertService.java
@@ -16,7 +16,7 @@
package com.android.calendar.alerts;
-import com.android.calendar.CalendarPreferenceActivity;
+import com.android.calendar.GeneralPreferences;
import com.android.calendar.R;
import com.android.calendar.R.string;
@@ -253,10 +253,10 @@ public class AlertService extends Service {
}
}
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(context);
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(context);
- boolean doAlert = prefs.getBoolean(CalendarPreferenceActivity.KEY_ALERTS, true);
- boolean doPopup = prefs.getBoolean(CalendarPreferenceActivity.KEY_ALERTS_POPUP, false);
+ boolean doAlert = prefs.getBoolean(GeneralPreferences.KEY_ALERTS, true);
+ boolean doPopup = prefs.getBoolean(GeneralPreferences.KEY_ALERTS_POPUP, false);
// TODO check for this before adding stuff to the alerts table.
if (!doAlert) {
@@ -311,15 +311,15 @@ public class AlertService extends Service {
// Find out the circumstances under which to vibrate.
// Migrate from pre-Froyo boolean setting if necessary.
String vibrateWhen; // "always" or "silent" or "never"
- if(prefs.contains(CalendarPreferenceActivity.KEY_ALERTS_VIBRATE_WHEN))
+ if(prefs.contains(GeneralPreferences.KEY_ALERTS_VIBRATE_WHEN))
{
// Look up Froyo setting
vibrateWhen =
- prefs.getString(CalendarPreferenceActivity.KEY_ALERTS_VIBRATE_WHEN, null);
- } else if(prefs.contains(CalendarPreferenceActivity.KEY_ALERTS_VIBRATE)) {
+ prefs.getString(GeneralPreferences.KEY_ALERTS_VIBRATE_WHEN, null);
+ } else if(prefs.contains(GeneralPreferences.KEY_ALERTS_VIBRATE)) {
// No Froyo setting. Migrate pre-Froyo setting to new Froyo-defined value.
boolean vibrate =
- prefs.getBoolean(CalendarPreferenceActivity.KEY_ALERTS_VIBRATE, false);
+ prefs.getBoolean(GeneralPreferences.KEY_ALERTS_VIBRATE, false);
vibrateWhen = vibrate ?
context.getString(R.string.prefDefault_alerts_vibrate_true) :
context.getString(R.string.prefDefault_alerts_vibrate_false);
@@ -342,7 +342,7 @@ public class AlertService extends Service {
// Possibly generate a sound. If 'Silent' is chosen, the ringtone
// string will be empty.
String reminderRingtone = prefs.getString(
- CalendarPreferenceActivity.KEY_ALERTS_RINGTONE, null);
+ GeneralPreferences.KEY_ALERTS_RINGTONE, null);
notification.sound = TextUtils.isEmpty(reminderRingtone) ? null : Uri
.parse(reminderRingtone);
}
diff --git a/src/com/android/calendar/event/EditEventView.java b/src/com/android/calendar/event/EditEventView.java
index 91cebde1..7fefc359 100644
--- a/src/com/android/calendar/event/EditEventView.java
+++ b/src/com/android/calendar/event/EditEventView.java
@@ -18,7 +18,7 @@ package com.android.calendar.event;
import com.android.calendar.CalendarEventModel;
import com.android.calendar.CalendarEventModel.Attendee;
-import com.android.calendar.CalendarPreferenceActivity;
+import com.android.calendar.GeneralPreferences;
import com.android.calendar.EmailAddressAdapter;
import com.android.calendar.R;
import com.android.calendar.TimezoneAdapter;
@@ -640,7 +640,7 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
String defaultCalendar = mCalendarsCursor
.getString(EditEventHelper.CALENDARS_INDEX_OWNER_ACCOUNT);
Utils.setSharedPreference(mActivity,
- CalendarPreferenceActivity.KEY_DEFAULT_CALENDAR, defaultCalendar);
+ GeneralPreferences.KEY_DEFAULT_CALENDAR, defaultCalendar);
mModel.mOwnerAccount = defaultCalendar;
mModel.mOrganizer = defaultCalendar;
mModel.mCalendarId = mCalendarsCursor.getLong(EditEventHelper.CALENDARS_INDEX_ID);
@@ -884,8 +884,8 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
String[] labels = r.getStringArray(R.array.reminder_minutes_labels);
mReminderLabels = new ArrayList<String>(Arrays.asList(labels));
- SharedPreferences prefs = CalendarPreferenceActivity.getSharedPreferences(mActivity);
- String durationString = prefs.getString(CalendarPreferenceActivity.KEY_DEFAULT_REMINDER,
+ SharedPreferences prefs = GeneralPreferences.getSharedPreferences(mActivity);
+ String durationString = prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER,
"0");
mDefaultReminderMinutes = Integer.parseInt(durationString);
@@ -1021,7 +1021,7 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
}
String defaultCalendar = Utils.getSharedPreference(mActivity,
- CalendarPreferenceActivity.KEY_DEFAULT_CALENDAR, null);
+ GeneralPreferences.KEY_DEFAULT_CALENDAR, null);
if (defaultCalendar == null) {
return 0;