mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -05:00
Set interface makes more sense for flags
This commit is contained in:
parent
195f28db00
commit
40102d560d
@ -2410,7 +2410,7 @@ public class MessagingController implements Runnable {
|
||||
if (messages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
remoteFolder.setFlags(messages, Collections.singletonList(flag), newState);
|
||||
remoteFolder.setFlags(messages, Collections.singleton(flag), newState);
|
||||
} finally {
|
||||
closeFolder(remoteFolder);
|
||||
}
|
||||
@ -2602,7 +2602,7 @@ public class MessagingController implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
remoteFolder.setFlags(Collections.singletonList(Flag.SEEN), true);
|
||||
remoteFolder.setFlags(Collections.singleton(Flag.SEEN), true);
|
||||
remoteFolder.close();
|
||||
} catch (UnsupportedOperationException uoe) {
|
||||
Log.w(K9.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe);
|
||||
@ -2878,7 +2878,7 @@ public class MessagingController implements Runnable {
|
||||
}
|
||||
|
||||
// Update the messages in the local store
|
||||
localFolder.setFlags(messages, Collections.singletonList(flag), newState);
|
||||
localFolder.setFlags(messages, Collections.singleton(flag), newState);
|
||||
|
||||
int unreadMessageCount = localFolder.getUnreadMessageCount();
|
||||
for (MessagingListener l : getListeners()) {
|
||||
|
@ -130,10 +130,10 @@ public abstract class Folder {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void setFlags(List<? extends Message> messages, Collection<Flag> flags, boolean value)
|
||||
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value)
|
||||
throws MessagingException;
|
||||
|
||||
public abstract void setFlags(Collection<Flag> flags, boolean value) throws MessagingException;
|
||||
public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException;
|
||||
|
||||
public abstract String getUidFromMessageId(Message message) throws MessagingException;
|
||||
|
||||
|
@ -210,8 +210,8 @@ public abstract class Message implements Part, CompositeBody {
|
||||
/*
|
||||
* TODO Refactor Flags at some point to be able to store user defined flags.
|
||||
*/
|
||||
public Collection<Flag> getFlags() {
|
||||
return Collections.unmodifiableCollection(mFlags);
|
||||
public Set<Flag> getFlags() {
|
||||
return Collections.unmodifiableSet(mFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,7 +235,7 @@ public abstract class Message implements Part, CompositeBody {
|
||||
* @param flags
|
||||
* @param set
|
||||
*/
|
||||
public void setFlags(final Collection<Flag> flags, boolean set) throws MessagingException {
|
||||
public void setFlags(final Set<Flag> flags, boolean set) throws MessagingException {
|
||||
for (Flag flag : flags) {
|
||||
setFlag(flag, set);
|
||||
}
|
||||
|
@ -2110,7 +2110,7 @@ public class ImapStore extends Store {
|
||||
|
||||
|
||||
@Override
|
||||
public void setFlags(Collection<Flag> flags, boolean value)
|
||||
public void setFlags(Set<Flag> flags, boolean value)
|
||||
throws MessagingException {
|
||||
open(OPEN_MODE_RW);
|
||||
checkOpen();
|
||||
@ -2145,7 +2145,7 @@ public class ImapStore extends Store {
|
||||
|
||||
|
||||
@Override
|
||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
||||
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||
throws MessagingException {
|
||||
open(OPEN_MODE_RW);
|
||||
checkOpen();
|
||||
@ -2911,7 +2911,7 @@ public class ImapStore extends Store {
|
||||
@Override
|
||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||
super.setFlag(flag, set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -977,12 +977,12 @@ public class Pop3Store extends Store {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(final Collection<Flag> flags, boolean value) throws MessagingException {
|
||||
throw new UnsupportedOperationException("POP3: No setFlags(Collection<Flag>,boolean)");
|
||||
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
||||
throw new UnsupportedOperationException("POP3: No setFlags(Set<Flag>,boolean)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
||||
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||
throws MessagingException {
|
||||
if (!value || !flags.contains(Flag.DELETED)) {
|
||||
/*
|
||||
@ -1187,7 +1187,7 @@ public class Pop3Store extends Store {
|
||||
@Override
|
||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||
super.setFlag(flag, set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1781,7 +1781,7 @@ public class WebDavStore extends Store {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(List<? extends Message> messages, final Collection<Flag> flags, boolean value)
|
||||
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
|
||||
throws MessagingException {
|
||||
String[] uids = new String[messages.size()];
|
||||
|
||||
@ -1929,9 +1929,9 @@ public class WebDavStore extends Store {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(final Collection<Flag> flags, boolean value) throws MessagingException {
|
||||
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
||||
Log.e(K9.LOG_TAG,
|
||||
"Unimplemented method setFlags(Collection<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
||||
"Unimplemented method setFlags(Set<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
||||
// Try to make this efficient by not retrieving all of the messages
|
||||
}
|
||||
}
|
||||
@ -2029,7 +2029,7 @@ public class WebDavStore extends Store {
|
||||
@Override
|
||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||
super.setFlag(flag, set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singletonList(flag), set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ public class LocalFolder extends Folder implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(final List<? extends Message> messages, final Collection<Flag> flags, final boolean value)
|
||||
public void setFlags(final List<? extends Message> messages, final Set<Flag> flags, final boolean value)
|
||||
throws MessagingException {
|
||||
open(OPEN_MODE_RW);
|
||||
|
||||
@ -1752,7 +1752,7 @@ public class LocalFolder extends Folder implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(final Collection<Flag> flags, boolean value)
|
||||
public void setFlags(final Set<Flag> flags, boolean value)
|
||||
throws MessagingException {
|
||||
open(OPEN_MODE_RW);
|
||||
for (Message message : getMessages(null)) {
|
||||
|
Loading…
Reference in New Issue
Block a user