Show new and old notifications in the same list.

Relies on change-id I008afefc in f/b.

Change-Id: Id474639910ec54f129395e1734cf92203879723d
This commit is contained in:
Daniel Sandler
2013-03-07 16:39:06 -05:00
parent c97593b9fd
commit c00e410b35

View File

@@ -160,35 +160,39 @@ public class NotificationStation extends SettingsPreferenceFragment {
public int priority; public int priority;
public int user; public int user;
public long timestamp; public long timestamp;
public boolean active;
} }
private List<HistoricalNotificationInfo> loadNotifications() { private List<HistoricalNotificationInfo> loadNotifications() {
final int currentUserId = ActivityManager.getCurrentUser(); final int currentUserId = ActivityManager.getCurrentUser();
try { try {
StatusBarNotification[] nions; StatusBarNotification[] active = mNoMan.getActiveNotifications(mContext.getPackageName());
nions = SHOW_HISTORICAL_NOTIFICATIONS StatusBarNotification[] dismissed = mNoMan.getHistoricalNotifications(mContext.getPackageName(), 50);
? mNoMan.getHistoricalNotifications(mContext.getPackageName(), 50)
: mNoMan.getActiveNotifications(mContext.getPackageName());
List<HistoricalNotificationInfo> list List<HistoricalNotificationInfo> list
= new ArrayList<HistoricalNotificationInfo>(nions.length); = new ArrayList<HistoricalNotificationInfo>(active.length + dismissed.length);
for (StatusBarNotification sbn : nions) { for (StatusBarNotification[] resultset
final HistoricalNotificationInfo info = new HistoricalNotificationInfo(); : new StatusBarNotification[][] { active, dismissed }) {
info.pkg = sbn.pkg; for (StatusBarNotification sbn : resultset) {
info.user = sbn.getUserId(); final HistoricalNotificationInfo info = new HistoricalNotificationInfo();
info.icon = loadIconDrawable(info.pkg, info.user, sbn.notification.icon); info.pkg = sbn.pkg;
info.pkgicon = loadPackageIconDrawable(info.pkg, info.user); info.user = sbn.getUserId();
if (sbn.notification.extras != null) { info.icon = loadIconDrawable(info.pkg, info.user, sbn.notification.icon);
info.title = sbn.notification.extras.getString(Notification.EXTRA_TITLE); info.pkgicon = loadPackageIconDrawable(info.pkg, info.user);
} if (sbn.notification.extras != null) {
info.timestamp = sbn.postTime; info.title = sbn.notification.extras.getString(Notification.EXTRA_TITLE);
info.priority = sbn.notification.priority; }
logd(" [%d] %s: %s", info.timestamp, info.pkg, info.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.active = (resultset == active);
|| info.user == currentUserId) {
list.add(info); if (info.user == UserHandle.USER_ALL
|| info.user == currentUserId) {
list.add(info);
}
} }
} }
@@ -275,6 +279,8 @@ public class NotificationStation extends SettingsPreferenceFragment {
// bind caption // bind caption
((TextView) row.findViewById(android.R.id.title)).setText(info.title); ((TextView) row.findViewById(android.R.id.title)).setText(info.title);
row.setAlpha(info.active ? 1.0f : 0.5f);
// // bind radio button // // bind radio button
// RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1); // RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1);
// radioButton.setChecked(dreamInfo.isActive); // radioButton.setChecked(dreamInfo.isActive);