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:
Julia Reynolds
2020-02-13 17:11:27 -05:00
parent b67662bc67
commit 2eb9ef4d6f
3 changed files with 19 additions and 14 deletions

View File

@@ -19,8 +19,7 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@*android:color/material_grey_50">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@@ -100,17 +99,13 @@
android:layout_height="wrap_content"
android:clipChildren="true"
android:elevation="3dp"
android:background="@drawable/rounded_bg"
settings:layout_constraintHeight_max="200dp"
settings:layout_constrainedHeight="true">
android:background="@drawable/rounded_bg">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:clipChildren="true"
settings:layout_constraintHeight_max="300dp"
settings:layout_constrainedHeight="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
@@ -144,10 +139,8 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:clipChildren="true"
settings:layout_constraintHeight_max="300dp"
settings:layout_constrainedHeight="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"

View File

@@ -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);

View File

@@ -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();
}