1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-15 14:05:05 -05:00

Code cleanup and simplification

This commit is contained in:
cketti 2012-09-18 04:16:01 +02:00
parent de59725743
commit 42e0b3e045

View File

@ -1,7 +1,6 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.EnumMap; import java.util.EnumMap;
@ -1360,46 +1359,17 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
} }
} }
private void onToggleRead(final List<MessageInfoHolder> holders) { private void onToggleFlag(MessageInfoHolder messageInfo) {
LocalMessage message; LocalMessage message = messageInfo.message;
Folder folder; Folder folder = message.getFolder();
Account account; Account account = folder.getAccount();
String folderName; String folderName = folder.getName();
int i = 0; mController.setFlag(account, folderName, new Message[] { message }, Flag.FLAGGED,
for (final Iterator<MessageInfoHolder> iterator = holders.iterator(); iterator.hasNext(); i++) { !messageInfo.flagged);
final MessageInfoHolder messageInfo = iterator.next();
message = messageInfo.message;
folder = message.getFolder();
account = folder.getAccount();
folderName = message.getFolder().getName();
mController.setFlag(account, folderName, new Message[]{message}, Flag.SEEN, !messageInfo.read); messageInfo.flagged = !messageInfo.flagged;
mAdapter.sortMessages();
messageInfo.read = !messageInfo.read;
mAdapter.sortMessages();
}
}
private void onToggleFlag(final List<MessageInfoHolder> holders) {
LocalMessage message;
Folder folder;
Account account;
String folderName;
int i = 0;
for (final Iterator<MessageInfoHolder> iterator = holders.iterator(); iterator.hasNext(); i++) {
final MessageInfoHolder messageInfo = iterator.next();
message = messageInfo.message;
folder = message.getFolder();
account = folder.getAccount();
folderName = message.getFolder().getName();
mController.setFlag(account, folderName, new Message[]{message}, Flag.FLAGGED, !messageInfo.flagged);
messageInfo.flagged = !messageInfo.flagged;
mAdapter.sortMessages();
}
computeBatchDirection(); computeBatchDirection();
} }
@ -1973,7 +1943,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
public void onClick(View v) { public void onClick(View v) {
// Perform action on clicks // Perform action on clicks
MessageInfoHolder message = (MessageInfoHolder) getItem((Integer)v.getTag()); MessageInfoHolder message = (MessageInfoHolder) getItem((Integer)v.getTag());
onToggleFlag(Arrays.asList(new MessageInfoHolder[]{message})); onToggleFlag(message);
} }
}; };