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:
@@ -19,8 +19,7 @@
|
|||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/scroll"
|
android:id="@+id/scroll"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="@*android:color/material_grey_50">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -100,17 +99,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipChildren="true"
|
android:clipChildren="true"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
android:background="@drawable/rounded_bg"
|
android:background="@drawable/rounded_bg">
|
||||||
settings:layout_constraintHeight_max="200dp"
|
|
||||||
settings:layout_constrainedHeight="true">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/notification_list"
|
android:id="@+id/notification_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:clipChildren="true"
|
android:clipChildren="true"
|
||||||
settings:layout_constraintHeight_max="300dp"
|
|
||||||
settings:layout_constrainedHeight="true"
|
|
||||||
settings:fastScrollEnabled="true"
|
settings:fastScrollEnabled="true"
|
||||||
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
||||||
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
||||||
@@ -144,10 +139,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/notification_list"
|
android:id="@+id/notification_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:clipChildren="true"
|
android:clipChildren="true"
|
||||||
settings:layout_constraintHeight_max="300dp"
|
|
||||||
settings:layout_constrainedHeight="true"
|
|
||||||
settings:fastScrollEnabled="true"
|
settings:fastScrollEnabled="true"
|
||||||
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
||||||
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
|
|
||||||
mPm = getPackageManager();
|
mPm = getPackageManager();
|
||||||
|
|
||||||
|
mTodayView.removeAllViews();
|
||||||
mHistoryLoader = new HistoryLoader(this, new NotificationBackend(), mPm);
|
mHistoryLoader = new HistoryLoader(this, new NotificationBackend(), mPm);
|
||||||
mHistoryLoader.load(mOnHistoryLoaderListener);
|
mHistoryLoader.load(mOnHistoryLoaderListener);
|
||||||
|
|
||||||
@@ -245,16 +246,18 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
||||||
rv.setLayoutManager(lm);
|
rv.setLayoutManager(lm);
|
||||||
rv.setAdapter(new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm));
|
rv.setAdapter(new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm));
|
||||||
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
|
||||||
Arrays.asList(snoozed));
|
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
||||||
rv.getContext(), lm.getOrientation());
|
rv.getContext(), lm.getOrientation());
|
||||||
rv.addItemDecoration(dividerItemDecoration);
|
rv.addItemDecoration(dividerItemDecoration);
|
||||||
|
rv.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
|
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
||||||
|
Arrays.asList(snoozed));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StatusBarNotification[] dismissed = mNm.getHistoricalNotifications(
|
StatusBarNotification[] dismissed = mNm.getHistoricalNotifications(
|
||||||
NotificationHistoryActivity.this.getPackageName(), 10, false);
|
NotificationHistoryActivity.this.getPackageName(), 6, false);
|
||||||
RecyclerView rv = mDismissView.findViewById(R.id.notification_list);
|
RecyclerView rv = mDismissView.findViewById(R.id.notification_list);
|
||||||
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
|
||||||
rv.setLayoutManager(lm);
|
rv.setLayoutManager(lm);
|
||||||
@@ -262,6 +265,8 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
|
||||||
rv.getContext(), lm.getOrientation());
|
rv.getContext(), lm.getOrientation());
|
||||||
rv.addItemDecoration(dividerItemDecoration);
|
rv.addItemDecoration(dividerItemDecoration);
|
||||||
|
rv.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete(
|
||||||
Arrays.asList(dismissed));
|
Arrays.asList(dismissed));
|
||||||
mDismissView.setVisibility(View.VISIBLE);
|
mDismissView.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -94,6 +94,13 @@ public class NotificationSbnAdapter extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onRebuildComplete(List<StatusBarNotification> notifications) {
|
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;
|
mValues = notifications;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user