Loading res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,8 @@ <!-- Alarm Alert screen: this message is shown after an alarm rung unattended for a number of minutes. It tells the user that the alarm has been silenced.--> <string name="alarm_alert_alert_silenced">Alarm silenced after <xliff:g id="minutes">%d</xliff:g> minutes.</string> <string name="alarm_missed_title">Missed alarm</string> <string name="alarm_missed_text"><xliff:g id="alarm_time">%s</xliff:g> - <xliff:g id="alarm_label">%s</xliff:g></string> <!-- Button labels on the alarm dialog: Snooze --> <string name="alarm_alert_snooze_text">Snooze</string> Loading src/com/android/deskclock/AlarmReceiver.java +17 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.os.Parcel; import android.os.PowerManager.WakeLock; import android.text.TextUtils; import com.android.deskclock.provider.Alarm; Loading Loading @@ -235,13 +236,22 @@ public class AlarmReceiver extends BroadcastReceiver { // Update the notification to indicate that the alert has been // silenced. String label = alarm.getLabelOrDefault(context); Notification n = new Notification(R.drawable.stat_notify_alarm, label, alarm.calculateAlarmTime()); n.setLatestEventInfo(context, label, context.getString(R.string.alarm_alert_alert_silenced, timeout), intent); n.flags |= Notification.FLAG_AUTO_CANCEL; String title = context.getString(R.string.alarm_missed_title); String label = alarm.label; String alarmTime = Alarms.formatTime(context, alarm.calculateAlarmCalendar()); // If the label is null, just show the alarm time. If not, show "time - label". String text = TextUtils.isEmpty(label)? alarmTime : context.getString(R.string.alarm_missed_text, alarmTime, label); Notification n = new Notification.Builder(context) .setContentTitle(title) .setContentText(text) .setSmallIcon(R.drawable.stat_notify_alarm) .setAutoCancel(true) .setPriority(Notification.PRIORITY_HIGH) .setDefaults(Notification.DEFAULT_ALL) .build(); n.contentIntent = intent; // We have to cancel the original notification since it is in the // ongoing section and we want the "killed" notification to be a plain // notification. Loading src/com/android/deskclock/provider/Alarm.java +6 −1 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ public final class Alarm implements Parcelable, ClockContract.AlarmsColumns { } public long calculateAlarmTime() { Calendar c = calculateAlarmCalendar(); return c.getTimeInMillis(); } public Calendar calculateAlarmCalendar() { // start with now Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); Loading @@ -310,7 +315,7 @@ public final class Alarm implements Parcelable, ClockContract.AlarmsColumns { if (addDays > 0) { c.add(Calendar.DAY_OF_WEEK, addDays); } return c.getTimeInMillis(); return c; } @Override Loading Loading
res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,8 @@ <!-- Alarm Alert screen: this message is shown after an alarm rung unattended for a number of minutes. It tells the user that the alarm has been silenced.--> <string name="alarm_alert_alert_silenced">Alarm silenced after <xliff:g id="minutes">%d</xliff:g> minutes.</string> <string name="alarm_missed_title">Missed alarm</string> <string name="alarm_missed_text"><xliff:g id="alarm_time">%s</xliff:g> - <xliff:g id="alarm_label">%s</xliff:g></string> <!-- Button labels on the alarm dialog: Snooze --> <string name="alarm_alert_snooze_text">Snooze</string> Loading
src/com/android/deskclock/AlarmReceiver.java +17 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.os.Parcel; import android.os.PowerManager.WakeLock; import android.text.TextUtils; import com.android.deskclock.provider.Alarm; Loading Loading @@ -235,13 +236,22 @@ public class AlarmReceiver extends BroadcastReceiver { // Update the notification to indicate that the alert has been // silenced. String label = alarm.getLabelOrDefault(context); Notification n = new Notification(R.drawable.stat_notify_alarm, label, alarm.calculateAlarmTime()); n.setLatestEventInfo(context, label, context.getString(R.string.alarm_alert_alert_silenced, timeout), intent); n.flags |= Notification.FLAG_AUTO_CANCEL; String title = context.getString(R.string.alarm_missed_title); String label = alarm.label; String alarmTime = Alarms.formatTime(context, alarm.calculateAlarmCalendar()); // If the label is null, just show the alarm time. If not, show "time - label". String text = TextUtils.isEmpty(label)? alarmTime : context.getString(R.string.alarm_missed_text, alarmTime, label); Notification n = new Notification.Builder(context) .setContentTitle(title) .setContentText(text) .setSmallIcon(R.drawable.stat_notify_alarm) .setAutoCancel(true) .setPriority(Notification.PRIORITY_HIGH) .setDefaults(Notification.DEFAULT_ALL) .build(); n.contentIntent = intent; // We have to cancel the original notification since it is in the // ongoing section and we want the "killed" notification to be a plain // notification. Loading
src/com/android/deskclock/provider/Alarm.java +6 −1 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ public final class Alarm implements Parcelable, ClockContract.AlarmsColumns { } public long calculateAlarmTime() { Calendar c = calculateAlarmCalendar(); return c.getTimeInMillis(); } public Calendar calculateAlarmCalendar() { // start with now Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); Loading @@ -310,7 +315,7 @@ public final class Alarm implements Parcelable, ClockContract.AlarmsColumns { if (addDays > 0) { c.add(Calendar.DAY_OF_WEEK, addDays); } return c.getTimeInMillis(); return c; } @Override Loading