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,20 +160,21 @@ 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
: new StatusBarNotification[][] { active, dismissed }) {
for (StatusBarNotification sbn : resultset) {
final HistoricalNotificationInfo info = new HistoricalNotificationInfo(); final HistoricalNotificationInfo info = new HistoricalNotificationInfo();
info.pkg = sbn.pkg; info.pkg = sbn.pkg;
info.user = sbn.getUserId(); info.user = sbn.getUserId();
@@ -186,11 +187,14 @@ public class NotificationStation extends SettingsPreferenceFragment {
info.priority = sbn.notification.priority; info.priority = sbn.notification.priority;
logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title);
info.active = (resultset == active);
if (info.user == UserHandle.USER_ALL if (info.user == UserHandle.USER_ALL
|| info.user == currentUserId) { || info.user == currentUserId) {
list.add(info); list.add(info);
} }
} }
}
return list; return list;
} catch (RemoteException e) { } catch (RemoteException e) {
@@ -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);