From c00e410b3536f52b8104c92eb2a4ac3d90399ce5 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 7 Mar 2013 16:39:06 -0500 Subject: [PATCH] Show new and old notifications in the same list. Relies on change-id I008afefc in f/b. Change-Id: Id474639910ec54f129395e1734cf92203879723d --- .../android/settings/NotificationStation.java | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/com/android/settings/NotificationStation.java b/src/com/android/settings/NotificationStation.java index b56fbd4fc12..1242d850597 100644 --- a/src/com/android/settings/NotificationStation.java +++ b/src/com/android/settings/NotificationStation.java @@ -160,35 +160,39 @@ public class NotificationStation extends SettingsPreferenceFragment { public int priority; public int user; public long timestamp; + public boolean active; } private List loadNotifications() { final int currentUserId = ActivityManager.getCurrentUser(); try { - StatusBarNotification[] nions; - nions = SHOW_HISTORICAL_NOTIFICATIONS - ? mNoMan.getHistoricalNotifications(mContext.getPackageName(), 50) - : mNoMan.getActiveNotifications(mContext.getPackageName()); + StatusBarNotification[] active = mNoMan.getActiveNotifications(mContext.getPackageName()); + StatusBarNotification[] dismissed = mNoMan.getHistoricalNotifications(mContext.getPackageName(), 50); List list - = new ArrayList(nions.length); + = new ArrayList(active.length + dismissed.length); - for (StatusBarNotification sbn : nions) { - final HistoricalNotificationInfo info = new HistoricalNotificationInfo(); - info.pkg = sbn.pkg; - info.user = sbn.getUserId(); - info.icon = loadIconDrawable(info.pkg, info.user, sbn.notification.icon); - info.pkgicon = loadPackageIconDrawable(info.pkg, info.user); - if (sbn.notification.extras != null) { - info.title = sbn.notification.extras.getString(Notification.EXTRA_TITLE); - } - info.timestamp = sbn.postTime; - info.priority = sbn.notification.priority; - logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); + for (StatusBarNotification[] resultset + : new StatusBarNotification[][] { active, dismissed }) { + for (StatusBarNotification sbn : resultset) { + final HistoricalNotificationInfo info = new HistoricalNotificationInfo(); + info.pkg = sbn.pkg; + info.user = sbn.getUserId(); + info.icon = loadIconDrawable(info.pkg, info.user, sbn.notification.icon); + info.pkgicon = loadPackageIconDrawable(info.pkg, info.user); + if (sbn.notification.extras != null) { + info.title = sbn.notification.extras.getString(Notification.EXTRA_TITLE); + } + info.timestamp = sbn.postTime; + info.priority = sbn.notification.priority; + logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); - if (info.user == UserHandle.USER_ALL - || info.user == currentUserId) { - list.add(info); + info.active = (resultset == active); + + if (info.user == UserHandle.USER_ALL + || info.user == currentUserId) { + list.add(info); + } } } @@ -275,6 +279,8 @@ public class NotificationStation extends SettingsPreferenceFragment { // bind caption ((TextView) row.findViewById(android.R.id.title)).setText(info.title); + row.setAlpha(info.active ? 1.0f : 0.5f); + // // bind radio button // RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1); // radioButton.setChecked(dreamInfo.isActive);