From 683f31e32ed842055acc342730d3379ad5db5da6 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 3 May 2010 13:46:55 +0000 Subject: [PATCH] Code cleanup: Fixed some warnings --- .../fsck/k9/MessagingControllerPushReceiver.java | 2 ++ src/com/fsck/k9/activity/MessageList.java | 2 -- src/com/fsck/k9/activity/MessageReference.java | 15 +++++++++++++++ src/com/fsck/k9/mail/Message.java | 12 ++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/MessagingControllerPushReceiver.java b/src/com/fsck/k9/MessagingControllerPushReceiver.java index 0630f25d6..bd3e53681 100644 --- a/src/com/fsck/k9/MessagingControllerPushReceiver.java +++ b/src/com/fsck/k9/MessagingControllerPushReceiver.java @@ -83,12 +83,14 @@ public class MessagingControllerPushReceiver implements PushReceiver final CountDownLatch latch = new CountDownLatch(1); controller.synchronizeMailbox(account, folder.getName(), new MessagingListener() { + @Override public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) { latch.countDown(); } + @Override public void synchronizeMailboxFailed(Account account, String folder, String message) { diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 388a751b9..8e8476c11 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -36,8 +36,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/src/com/fsck/k9/activity/MessageReference.java b/src/com/fsck/k9/activity/MessageReference.java index d3f15c1f8..786633780 100644 --- a/src/com/fsck/k9/activity/MessageReference.java +++ b/src/com/fsck/k9/activity/MessageReference.java @@ -8,6 +8,7 @@ public class MessageReference implements Serializable public String folderName; public String uid; + @Override public boolean equals(Object o) { if (o instanceof MessageReference == false) @@ -23,6 +24,20 @@ public class MessageReference implements Serializable } return false; } + + @Override + public int hashCode() + { + final int MULTIPLIER = 31; + + int result = 1; + result = MULTIPLIER * result + ((accountUuid == null) ? 0 : accountUuid.hashCode()); + result = MULTIPLIER * result + ((folderName == null) ? 0 : folderName.hashCode()); + result = MULTIPLIER * result + ((uid == null) ? 0 : uid.hashCode()); + return result; + } + + @Override public String toString() { return "MessageReference{accountUuid = '" + diff --git a/src/com/fsck/k9/mail/Message.java b/src/com/fsck/k9/mail/Message.java index ce4a26a42..dec4f93d9 100644 --- a/src/com/fsck/k9/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -23,6 +23,7 @@ public abstract class Message implements Part, Body protected Folder mFolder; + @Override public boolean equals(Object o) { if (o == null || o instanceof Message == false) @@ -35,6 +36,17 @@ public abstract class Message implements Part, Body && mUid.equals(other.getUid())); } + @Override + public int hashCode() + { + final int MULTIPLIER = 31; + + int result = 1; + result = MULTIPLIER * result + mFolder.getName().hashCode(); + result = MULTIPLIER * result + mFolder.getAccount().getUuid().hashCode(); + result = MULTIPLIER * result + mUid.hashCode(); + return result; + } public String getUid() {