/** * Based on change in alarm scheduling related preferences, pop up a toast message telling the * user if the alarm is ready to go or not * * @param wakeupEnabled true if the "enable wake-up" box is checked */ private void alarmSchedulingPreferenceUpdated(boolean wakeupEnabled) { if (wakeupEnabled) { if (Alarms.getEnabledAlarmsQuery(getContentResolver()).getCount() != 0) { int wakeupEnabledResorts = 0; for (Resort r : mResortManager.getResorts()) { if (r.isWakeupEnabled()) { wakeupEnabledResorts++; } } Toast toast; if (wakeupEnabledResorts != 0) { toast = Toast.makeText(this, R.string.alarm_updated, Toast.LENGTH_SHORT); } else { toast = Toast.makeText(this, R.string.please_enable_wakeup_on_resort, Toast.LENGTH_SHORT); } toast.show(); } else { Log.d("No alarm configured"); Toast toast = Toast.makeText(this, R.string.alarm_not_set, Toast.LENGTH_SHORT); toast.show(); } } else { Log.d("Alarm is not enabled"); Toast toast = Toast.makeText(this, R.string.wakeup_disabled, Toast.LENGTH_SHORT); toast.show(); } }
/** Syncs the enabled state of alarm related settings to the enable checkbox */ private void updateAlarmPreferences() { boolean enabled = mAlarmEnablePreference.isChecked(); mWakeupSnowSettings.setEnabled(enabled); String alarmSettingsSummary = getString( R.string.count_alarms_enabled, Alarms.getEnabledAlarmsQuery(getContentResolver()).getCount()); /** Set the number of currently enabled alarms in the alarm preferences dialog */ mAlarmSettingsPreference.setSummary(alarmSettingsSummary); }