Notification history improvements
- don't keep readding history list onresume - remove unstyled background (just use elevation for contrast for now) - remove summaries from snoozed and recently dimissed because the user wouldn't have seen their content Test: manual Fixes: 149499024 Change-Id: Ie43c752f42a7dfcac5ca9e3d118df07124daf974
This commit is contained in:
@@ -129,6 +129,7 @@ public class NotificationHistoryActivity extends Activity {
|
||||
|
||||
mPm = getPackageManager();
|
||||
|
||||
mTodayView.removeAllViews();
|
||||
mHistoryLoader = new HistoryLoader(this, new NotificationBackend(), mPm);
|
||||
mHistoryLoader.load(mOnHistoryLoaderListener);
|
||||
|
||||
@@ -245,16 +246,18 @@ public class NotificationHistoryActivity extends Activity {
|
||||
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
||||
rv.setLayoutManager(lm);
|
||||
rv.setAdapter(new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm));
|
||||
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
||||
Arrays.asList(snoozed));
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
||||
rv.getContext(), lm.getOrientation());
|
||||
rv.addItemDecoration(dividerItemDecoration);
|
||||
rv.setNestedScrollingEnabled(false);
|
||||
|
||||
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
||||
Arrays.asList(snoozed));
|
||||
}
|
||||
|
||||
try {
|
||||
StatusBarNotification[] dismissed = mNm.getHistoricalNotifications(
|
||||
NotificationHistoryActivity.this.getPackageName(), 10, false);
|
||||
NotificationHistoryActivity.this.getPackageName(), 6, false);
|
||||
RecyclerView rv = mDismissView.findViewById(R.id.notification_list);
|
||||
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
||||
rv.setLayoutManager(lm);
|
||||
@@ -262,6 +265,8 @@ public class NotificationHistoryActivity extends Activity {
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
||||
rv.getContext(), lm.getOrientation());
|
||||
rv.addItemDecoration(dividerItemDecoration);
|
||||
rv.setNestedScrollingEnabled(false);
|
||||
|
||||
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
||||
Arrays.asList(dismissed));
|
||||
mDismissView.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -94,6 +94,13 @@ public class NotificationSbnAdapter extends
|
||||
}
|
||||
|
||||
public void onRebuildComplete(List<StatusBarNotification> notifications) {
|
||||
// summaries are low content; don't bother showing them
|
||||
for (int i = notifications.size() - 1; i >= 0; i--) {
|
||||
StatusBarNotification sbn = notifications.get(i);
|
||||
if (sbn.isGroup() && sbn.getNotification().isGroupSummary()) {
|
||||
notifications.remove(i);
|
||||
}
|
||||
}
|
||||
mValues = notifications;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user