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) if (filter_duplicates && message.duplicate)
return R.layout.item_message_duplicate; return R.layout.item_message_duplicate;
if (filter_trash && differ.getItemCount() > 1 && if (filter_trash && EntityFolder.TRASH.equals(message.folderType) && !allTrashed(message))
EntityFolder.TRASH.equals(message.folderType))
return R.layout.item_message_duplicate; return R.layout.item_message_duplicate;
return (compact ? R.layout.item_message_compact : R.layout.item_message_normal); 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) || if ((filter_duplicates && message.duplicate) ||
(filter_trash && differ.getItemCount() > 1 && (filter_trash && EntityFolder.TRASH.equals(message.folderType) && !allTrashed(message))) {
EntityFolder.TRASH.equals(message.folderType))) {
holder.card.setCardBackgroundColor(message.folderColor == null holder.card.setCardBackgroundColor(message.folderColor == null
? Color.TRANSPARENT ? Color.TRANSPARENT
: ColorUtils.setAlphaComponent(message.folderColor, 128)); : ColorUtils.setAlphaComponent(message.folderColor, 128));
@ -8084,6 +8082,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
holder.wire(); 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) { public void onItemSelected(@NonNull ViewHolder holder, boolean selected) {
if (accessibility && holder.view != null) if (accessibility && holder.view != null)
try { try {

Loading…
Cancel
Save