clone notification list for viewing

This commit is contained in:
Milos Kozak 2019-10-14 21:55:40 +02:00
parent 0f792dc092
commit 7596775331

View file

@ -172,7 +172,7 @@ public class NotificationStore {
removeExpired(); removeExpired();
unSnooze(); unSnooze();
if (store.size() > 0) { if (store.size() > 0) {
NotificationRecyclerViewAdapter adapter = new NotificationRecyclerViewAdapter(store); NotificationRecyclerViewAdapter adapter = new NotificationRecyclerViewAdapter(cloneStore());
notificationsView.setAdapter(adapter); notificationsView.setAdapter(adapter);
notificationsView.setVisibility(View.VISIBLE); notificationsView.setVisibility(View.VISIBLE);
} else { } else {
@ -180,4 +180,9 @@ public class NotificationStore {
} }
} }
private synchronized List<Notification> cloneStore() {
List<Notification> clone = new ArrayList<>(store.size());
clone.addAll(store);
return clone;
}
} }