diff options
author | Sara Ting <sarating@google.com> | 2012-08-31 15:06:32 -0700 |
---|---|---|
committer | Sara Ting <sarating@google.com> | 2012-08-31 15:06:32 -0700 |
commit | 7a2de3d0ba146217e19d8dba74ff82000b0e676f (patch) | |
tree | dd57a709984161622b96faade4a22e7ea1e6b633 /src | |
parent | a3a27fba18735a17b339afce46b12587be6f6b70 (diff) | |
parent | 013fda07b0ab9d0823097bd2050b48caf2ce5ab0 (diff) | |
download | android_packages_apps_Calendar-7a2de3d0ba146217e19d8dba74ff82000b0e676f.tar.gz android_packages_apps_Calendar-7a2de3d0ba146217e19d8dba74ff82000b0e676f.tar.bz2 android_packages_apps_Calendar-7a2de3d0ba146217e19d8dba74ff82000b0e676f.zip |
resolved conflicts for merge of 013fda07 to ics-ub-calendar-burgundy
Change-Id: Ia398c0dc2d7eed35e9d1f172e23e0f5c38923be3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/calendar/alerts/AlertService.java | 21 | ||||
-rw-r--r-- | src/com/android/calendar/alerts/NotificationMgr.java | 26 |
2 files changed, 22 insertions, 25 deletions
diff --git a/src/com/android/calendar/alerts/AlertService.java b/src/com/android/calendar/alerts/AlertService.java index 15986af6..9d75217b 100644 --- a/src/com/android/calendar/alerts/AlertService.java +++ b/src/com/android/calendar/alerts/AlertService.java @@ -143,7 +143,7 @@ public class AlertService extends Service { } // Added wrapper for testing - public static class NotificationMgrWrapper implements NotificationMgr { + public static class NotificationMgrWrapper extends NotificationMgr { NotificationManager mNm; public NotificationMgrWrapper(NotificationManager nm) { @@ -156,24 +156,9 @@ public class AlertService extends Service { } @Override - public void cancel(String tag, int id) { - mNm.cancel(tag, id); - } - - @Override - public void cancelAll() { - mNm.cancelAll(); - } - - @Override public void notify(int id, NotificationWrapper nw) { mNm.notify(id, nw.mNotification); } - - @Override - public void notify(String tag, int id, NotificationWrapper nw) { - mNm.notify(tag, id, nw.mNotification); - } } void processMessage(Message msg) { @@ -355,9 +340,7 @@ public class AlertService extends Service { // Remove the notifications that are hanging around from the previous refresh. if (currentNotificationId <= maxNotifications) { - for (int i = currentNotificationId; i <= maxNotifications; i++) { - nm.cancel(i); - } + nm.cancelAllBetween(currentNotificationId, maxNotifications); if (DEBUG) { Log.d(TAG, "Canceling leftover notification IDs " + currentNotificationId + "-" + maxNotifications); diff --git a/src/com/android/calendar/alerts/NotificationMgr.java b/src/com/android/calendar/alerts/NotificationMgr.java index e0a5baff..b62f6064 100644 --- a/src/com/android/calendar/alerts/NotificationMgr.java +++ b/src/com/android/calendar/alerts/NotificationMgr.java @@ -2,10 +2,24 @@ package com.android.calendar.alerts; import com.android.calendar.alerts.AlertService.NotificationWrapper; -public interface NotificationMgr { - public void cancel(int id); - public void cancel(String tag, int id); - public void cancelAll(); - public void notify(int id, NotificationWrapper notification); - public void notify(String tag, int id, NotificationWrapper notification); +public abstract class NotificationMgr { + public abstract void notify(int id, NotificationWrapper notification); + public abstract void cancel(int id); + + /** + * Don't actually use the notification framework's cancelAll since the SyncAdapter + * might post notifications and we don't want to affect those. + */ + public void cancelAll() { + cancelAllBetween(0, AlertService.MAX_NOTIFICATIONS); + } + + /** + * Cancels IDs between the specified bounds, inclusively. + */ + public void cancelAllBetween(int from, int to) { + for (int i = from; i <= to; i++) { + cancel(i); + } + } } |