summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2010-05-23 15:39:40 -0400
committerJoe Onorato <joeo@android.com>2010-06-02 14:48:43 -0700
commit66b4c5bb36f57a9d83bb7f34288235b82f9be407 (patch)
tree560522689de55630e509208bd91dabebdd7213ec /packages
parentaaba60b281713d45a0f232580302c7b54a7207df (diff)
downloadframeworks_base-66b4c5bb36f57a9d83bb7f34288235b82f9be407.zip
frameworks_base-66b4c5bb36f57a9d83bb7f34288235b82f9be407.tar.gz
frameworks_base-66b4c5bb36f57a9d83bb7f34288235b82f9be407.tar.bz2
Implement removeNotification.
Change-Id: I58b999901b45b4dce6d3af3a7701e0c9ad2b77df
Diffstat (limited to 'packages')
-rw-r--r--packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java18
-rw-r--r--packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java22
2 files changed, 37 insertions, 3 deletions
diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java
index ae71bda..5c7a90c 100644
--- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java
+++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/NotificationData.java
@@ -30,8 +30,8 @@ public class NotificationData {
public static final class Entry {
public IBinder key;
public StatusBarNotification notification;
- public StatusBarIconView icon;
public View expanded;
+ public StatusBarIconView icon;
}
private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
@@ -43,16 +43,30 @@ public class NotificationData {
return mEntries.get(index);
}
- public int add(IBinder key, StatusBarNotification notification, View expanded) {
+ public int add(IBinder key, StatusBarNotification notification, View expanded,
+ StatusBarIconView icon) {
Entry entry = new Entry();
entry.key = key;
entry.notification = notification;
entry.expanded = expanded;
+ entry.icon = icon;
final int index = chooseIndex(notification.notification.when);
mEntries.add(index, entry);
return index;
}
+ public Entry remove(IBinder key) {
+ final int N = mEntries.size();
+ for (int i=0; i<N; i++) {
+ Entry entry = mEntries.get(i);
+ if (entry.key == key) {
+ mEntries.remove(i);
+ return entry;
+ }
+ }
+ return null;
+ }
+
private int chooseIndex(final long when) {
final int N = mEntries.size();
for (int i=0; i<N; i++) {
diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java
index 97b38b6..bd9ecb6 100644
--- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java
+++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/PhoneStatusBarService.java
@@ -341,7 +341,7 @@ public class PhoneStatusBarService extends StatusBarService {
iconView.set(new StatusBarIcon(notification.pkg, notification.notification.icon,
notification.notification.iconLevel));
// Add the expanded view.
- final int viewIndex = list.add(key, notification, view);
+ final int viewIndex = list.add(key, notification, view, iconView);
parent.addView(view, viewIndex);
// Add the icon.
final int iconIndex = chooseIconIndex(isOngoing, viewIndex);
@@ -359,6 +359,26 @@ public class PhoneStatusBarService extends StatusBarService {
}
public void removeNotification(IBinder key) {
+ Slog.d(TAG, "removeNotification key=" + key);
+ NotificationData.Entry entry = mOngoing.remove(key);
+ if (entry == null) {
+ entry = mLatest.remove(key);
+ if (entry == null) {
+ Slog.w(TAG, "removeNotification for nonexistent key: " + key);
+ return;
+ }
+ }
+ // Remove the expanded view.
+ ((ViewGroup)entry.expanded.getParent()).removeView(entry.expanded);
+ // Remove the icon.
+ ((ViewGroup)entry.icon.getParent()).removeView(entry.icon);
+
+ // Cancel the ticker if it's still running
+ // TODO
+
+ // Recalculate the position of the sliding windows and the titles.
+ setAreThereNotifications();
+ updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
}
/**