mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 13:47:05 +02:00
Compose compare attachments
This commit is contained in:
@@ -32,6 +32,7 @@ import androidx.room.PrimaryKey;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
@@ -234,6 +235,33 @@ public class EntityAttachment {
|
||||
return type;
|
||||
}
|
||||
|
||||
public static boolean equals(List<EntityAttachment> a1, List<EntityAttachment> a2) {
|
||||
if (a1 == null || a2 == null)
|
||||
return false;
|
||||
|
||||
List<EntityAttachment> list = new ArrayList<>();
|
||||
|
||||
for (EntityAttachment a : a1)
|
||||
if (a.available && !a.isEncryption())
|
||||
list.add(a);
|
||||
|
||||
for (EntityAttachment a : a2)
|
||||
if (a.available && !a.isEncryption()) {
|
||||
boolean found = false;
|
||||
for (EntityAttachment l : list)
|
||||
if (Objects.equals(a.sequence, l.sequence) &&
|
||||
Objects.equals(a.subsequence, l.subsequence)) {
|
||||
list.remove(l);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (!found)
|
||||
return false;
|
||||
}
|
||||
|
||||
return (list.size() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EntityAttachment) {
|
||||
|
||||
Reference in New Issue
Block a user