Home | History | Annotate | Download | only in deskclock

Lines Matching refs:context

25 import android.content.Context;
113 public static long addAlarm(Context context, Alarm alarm) {
115 Uri uri = context.getContentResolver().insert(
121 clearSnoozeIfNeeded(context, timeInMillis);
123 setNextAlert(context);
131 public static void deleteAlarm(Context context, int alarmId) {
134 ContentResolver contentResolver = context.getContentResolver();
136 disableSnoozeAlert(context, alarmId);
141 setNextAlert(context);
145 public static CursorLoader getAlarmsCursorLoader(Context context) {
146 return new CursorLoader(context, Alarm.Columns.CONTENT_URI,
197 private static void clearSnoozeIfNeeded(Context context, long alarmTime) {
200 SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, 0);
208 clearSnoozePreference(context, prefs, alarmId);
238 public static long setAlarm(Context context, Alarm alarm) {
240 ContentResolver resolver = context.getContentResolver();
256 disableSnoozeAlert(context, alarm.id);
261 clearSnoozeIfNeeded(context, timeInMillis);
264 setNextAlert(context);
277 final Context context, final int id, boolean enabled) {
278 enableAlarmInternal(context, id, enabled);
279 setNextAlert(context);
282 private static void enableAlarmInternal(final Context context,
284 enableAlarmInternal(context, getAlarm(context.getContentResolver(), id),
288 private static void enableAlarmInternal(final Context context,
293 ContentResolver resolver = context.getContentResolver();
308 disableSnoozeAlert(context, alarm.id);
315 private static Alarm calculateNextAlert(final Context context) {
318 final SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, 0);
330 final Alarm a = getAlarm(context.getContentResolver(), alarmId);
335 final Cursor cursor = getFilteredAlarmsCursor(context.getContentResolver());
364 enableAlarmInternal(context, a, false);
380 public static void disableExpiredAlarms(final Context context) {
381 Cursor cur = getFilteredAlarmsCursor(context.getContentResolver());
393 enableAlarmInternal(context, alarm, false);
407 public static void setNextAlert(final Context context) {
408 final Alarm alarm = calculateNextAlert(context);
410 enableAlert(context, alarm, alarm.time);
412 disableAlert(context);
415 context.sendBroadcast(i);
425 private static void enableAlert(Context context, final Alarm alarm,
428 context.getSystemService(Context.ALARM_SERVICE);
451 context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
455 setStatusBarIcon(context, true);
459 String timeString = formatDayAndTime(context, c);
460 saveNextAlarm(context, timeString);
466 * @param context The context
468 static void disableAlert(Context context) {
470 context.getSystemService(Context.ALARM_SERVICE);
472 context, 0, new Intent(ALARM_ALERT_ACTION),
475 setStatusBarIcon(context, false);
479 saveNextAlarm(context, "");
482 static void saveSnoozeAlert(final Context context, final int id,
484 SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, 0);
486 clearAllSnoozePreferences(context, prefs);
497 setNextAlert(context);
511 static void disableSnoozeAlert(final Context context, final int id) {
512 SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, 0);
515 clearSnoozePreference(context, prefs, id);
522 private static void clearSnoozePreference(final Context context,
529 context.getSystemService(Context.NOTIFICATION_SERVICE);
540 private static void clearAllSnoozePreferences(final Context context,
543 context.getSystemService(Context.NOTIFICATION_SERVICE);
586 private static void setStatusBarIcon(Context context, boolean enabled) {
589 context.sendBroadcast(alarmChanged);
626 static String formatTime(final Context context, int hour, int minute,
629 return formatTime(context, c);
633 static String formatTime(final Context context, Calendar c) {
634 String format = get24HourMode(context) ? M24 : M12;
641 private static String formatDayAndTime(final Context context, Calendar c) {
642 String format = get24HourMode(context) ? DM24 : DM12;
650 static void saveNextAlarm(final Context context, String timeString) {
653 Settings.System.putString(context.getContentResolver(),
661 public static boolean get24HourMode(final Context context) {
662 return android.text.format.DateFormat.is24HourFormat(context);