Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Don't process null items
Browse files Browse the repository at this point in the history
  • Loading branch information
DreierF committed Oct 9, 2016
1 parent 56c0e52 commit bcfb80a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private List<T> getSelectedItems() {
List<Long> ids = mSelector.getSelectedIds();
return Stream.of(ids)
.map(id -> getAdapter().getItemById(id))
.filter(item -> item != null)
.collect(Collectors.toList());
}

Expand Down Expand Up @@ -122,7 +123,8 @@ private void remove(List<T> deleted) {
getAdapter().removeItem(item);
}
getAdapter().notifyDataSetChanged();
String message = getResources().getQuantityString(itemTypeDelRes, deleted.size(), deleted.size());
String message = getResources()
.getQuantityString(itemTypeDelRes, deleted.size(), deleted.size());
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG)
.setAction(R.string.undo, v -> {
for (T item : deleted) {
Expand Down Expand Up @@ -197,5 +199,6 @@ public void onLongClick(SelectableViewHolder holder) {
/**
* @param itemIds Items that have been selected
*/
protected void onStatistics(List<Long> itemIds) {}
protected void onStatistics(List<Long> itemIds) {
}
}

0 comments on commit bcfb80a

Please sign in to comment.