Propagate labels

This commit is contained in:
M66B
2020-06-25 19:53:30 +02:00
parent 1488a37caa
commit 141d57ba18
2 changed files with 63 additions and 18 deletions

View File

@@ -244,14 +244,28 @@ public class EntityMessage implements Serializable {
return "notification." + sender.getAddress().toLowerCase(Locale.ROOT);
}
void setLabel(String label, boolean set) {
boolean setLabel(String label, boolean set) {
List<String> list = new ArrayList<>();
if (labels != null)
list.addAll(Arrays.asList(labels));
list.remove(label);
if (set)
list.add(label);
labels = list.toArray(new String[0]);
boolean changed = false;
if (set) {
if (!list.contains(label)) {
changed = true;
list.add(label);
}
} else {
if (list.contains(label)) {
changed = true;
list.remove(label);
}
}
if (changed)
labels = list.toArray(new String[0]);
return changed;
}
static File getFile(Context context, Long id) {