Check for all trashed

pull/209/head
M66B 2 years ago
parent a72b72d3f7
commit ddc038106e

@ -8005,8 +8005,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (filter_duplicates && message.duplicate)
return R.layout.item_message_duplicate;
if (filter_trash && differ.getItemCount() > 1 &&
EntityFolder.TRASH.equals(message.folderType))
if (filter_trash && EntityFolder.TRASH.equals(message.folderType) && !allTrashed(message))
return R.layout.item_message_duplicate;
return (compact ? R.layout.item_message_compact : R.layout.item_message_normal);
@ -8056,8 +8055,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
if ((filter_duplicates && message.duplicate) ||
(filter_trash && differ.getItemCount() > 1 &&
EntityFolder.TRASH.equals(message.folderType))) {
(filter_trash && EntityFolder.TRASH.equals(message.folderType) && !allTrashed(message))) {
holder.card.setCardBackgroundColor(message.folderColor == null
? Color.TRANSPARENT
: ColorUtils.setAlphaComponent(message.folderColor, 128));
@ -8084,6 +8082,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
holder.wire();
}
private boolean allTrashed(TupleMessageEx message) {
if (differ.getItemCount() == 1)
return true;
for (int i = 0; i < differ.getItemCount(); i++) {
TupleMessageEx m = differ.getItem(i);
if (m == null || !EntityFolder.TRASH.equals(m.folderType))
return false;
}
return true;
}
public void onItemSelected(@NonNull ViewHolder holder, boolean selected) {
if (accessibility && holder.view != null)
try {

Loading…
Cancel
Save