Make MessagingListener an interface
This commit is contained in:
parent
aaa43e67eb
commit
93aaa85c14
14 changed files with 298 additions and 164 deletions
|
@ -30,7 +30,7 @@ import com.fsck.k9.Account.SortType;
|
||||||
import com.fsck.k9.activity.MessageCompose;
|
import com.fsck.k9.activity.MessageCompose;
|
||||||
import com.fsck.k9.activity.UpgradeDatabases;
|
import com.fsck.k9.activity.UpgradeDatabases;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.mail.K9MailLib;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
|
@ -553,7 +553,7 @@ public class K9 extends Application {
|
||||||
setServicesEnabled(this);
|
setServicesEnabled(this);
|
||||||
registerReceivers();
|
registerReceivers();
|
||||||
|
|
||||||
MessagingController.getInstance(this).addListener(new MessagingListener() {
|
MessagingController.getInstance(this).addListener(new SimpleMessagingListener() {
|
||||||
private void broadcastIntent(String action, Account account, String folder, Message message) {
|
private void broadcastIntent(String action, Account account, String folder, Message message) {
|
||||||
Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid()));
|
Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid()));
|
||||||
Intent intent = new Intent(action, uri);
|
Intent intent = new Intent(action, uri);
|
||||||
|
|
|
@ -10,10 +10,10 @@ import com.fsck.k9.Account;
|
||||||
import com.fsck.k9.AccountStats;
|
import com.fsck.k9.AccountStats;
|
||||||
import com.fsck.k9.K9;
|
import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.service.MailService;
|
import com.fsck.k9.service.MailService;
|
||||||
|
|
||||||
public class ActivityListener extends MessagingListener {
|
public class ActivityListener extends SimpleMessagingListener {
|
||||||
private Account mAccount = null;
|
private Account mAccount = null;
|
||||||
private String mLoadingFolderName = null;
|
private String mLoadingFolderName = null;
|
||||||
private String mLoadingHeaderFolderName = null;
|
private String mLoadingHeaderFolderName = null;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.fsck.k9.Preferences;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.mail.Folder;
|
import com.fsck.k9.mail.Folder;
|
||||||
import com.fsck.k9.mailstore.LocalFolder;
|
import com.fsck.k9.mailstore.LocalFolder;
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ public class ChooseFolder extends K9ListActivity {
|
||||||
MessagingController.getInstance(getApplication()).listFolders(mAccount, false, mListener);
|
MessagingController.getInstance(getApplication()).listFolders(mAccount, false, mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessagingListener mListener = new MessagingListener() {
|
private MessagingListener mListener = new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void listFoldersStarted(Account account) {
|
public void listFoldersStarted(Account account) {
|
||||||
if (!account.equals(mAccount)) {
|
if (!account.equals(mAccount)) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ import com.fsck.k9.activity.setup.FolderSettings;
|
||||||
import com.fsck.k9.activity.setup.Prefs;
|
import com.fsck.k9.activity.setup.Prefs;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.helper.SizeFormatter;
|
import com.fsck.k9.helper.SizeFormatter;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager;
|
import com.fsck.k9.mail.power.TracingPowerManager;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
||||||
|
@ -210,7 +211,7 @@ public class FolderList extends K9ListActivity {
|
||||||
final TracingWakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "FolderList checkMail");
|
final TracingWakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "FolderList checkMail");
|
||||||
wakeLock.setReferenceCounted(false);
|
wakeLock.setReferenceCounted(false);
|
||||||
wakeLock.acquire(K9.WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(K9.WAKE_LOCK_TIMEOUT);
|
||||||
MessagingListener listener = new MessagingListener() {
|
MessagingListener listener = new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) {
|
public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) {
|
||||||
if (!account.equals(mAccount)) {
|
if (!account.equals(mAccount)) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ import com.fsck.k9.activity.compose.SaveMessageTask;
|
||||||
import com.fsck.k9.activity.misc.Attachment;
|
import com.fsck.k9.activity.misc.Attachment;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.fragment.ProgressDialogFragment;
|
import com.fsck.k9.fragment.ProgressDialogFragment;
|
||||||
import com.fsck.k9.fragment.ProgressDialogFragment.CancelListener;
|
import com.fsck.k9.fragment.ProgressDialogFragment.CancelListener;
|
||||||
import com.fsck.k9.helper.Contacts;
|
import com.fsck.k9.helper.Contacts;
|
||||||
|
@ -1588,7 +1589,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO We miss callbacks for this listener if they happens while we are paused!
|
// TODO We miss callbacks for this listener if they happens while we are paused!
|
||||||
public MessagingListener messagingListener = new MessagingListener() {
|
public MessagingListener messagingListener = new SimpleMessagingListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
|
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.Preferences;
|
import com.fsck.k9.Preferences;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.helper.RetainFragment;
|
import com.fsck.k9.helper.RetainFragment;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mailstore.LocalMessage;
|
import com.fsck.k9.mailstore.LocalMessage;
|
||||||
|
@ -430,7 +431,7 @@ public class MessageLoaderHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagingListener downloadMessageListener = new MessagingListener() {
|
MessagingListener downloadMessageListener = new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void loadMessageRemoteFinished(Account account, String folder, String uid) {
|
public void loadMessageRemoteFinished(Account account, String folder, String uid) {
|
||||||
if (!messageReference.equals(account.getUuid(), folder, uid)) {
|
if (!messageReference.equals(account.getUuid(), folder, uid)) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Map.Entry;
|
||||||
import com.fsck.k9.Account;
|
import com.fsck.k9.Account;
|
||||||
|
|
||||||
|
|
||||||
class MemorizingMessagingListener extends MessagingListener {
|
class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
Map<String, Memory> memories = new HashMap<>(31);
|
Map<String, Memory> memories = new HashMap<>(31);
|
||||||
|
|
||||||
synchronized void removeAccount(Account account) {
|
synchronized void removeAccount(Account account) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class MessagingControllerPushReceiver implements PushReceiver {
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.v(K9.LOG_TAG, "syncFolder(" + folder.getName() + ")");
|
Log.v(K9.LOG_TAG, "syncFolder(" + folder.getName() + ")");
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
controller.synchronizeMailbox(account, folder.getName(), new MessagingListener() {
|
controller.synchronizeMailbox(account, folder.getName(), new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void synchronizeMailboxFinished(Account account, String folder,
|
public void synchronizeMailboxFinished(Account account, String folder,
|
||||||
int totalMessagesInMailbox, int numNewMessages) {
|
int totalMessagesInMailbox, int numNewMessages) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package com.fsck.k9.controller;
|
package com.fsck.k9.controller;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -13,162 +14,71 @@ import com.fsck.k9.mail.Part;
|
||||||
import com.fsck.k9.mailstore.LocalFolder;
|
import com.fsck.k9.mailstore.LocalFolder;
|
||||||
import com.fsck.k9.mailstore.LocalMessage;
|
import com.fsck.k9.mailstore.LocalMessage;
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the interface that {@link MessagingController} will use to callback to requesters.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* This class is defined as non-abstract so that someone who wants to receive only a few messages
|
|
||||||
* can do so without implementing the entire interface. It is highly recommended that users of this
|
|
||||||
* interface use the {@code @Override} annotation in their implementations to avoid being caught by
|
|
||||||
* changes in this class.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class MessagingListener {
|
|
||||||
public void searchStats(AccountStats stats) {}
|
|
||||||
|
|
||||||
|
public interface MessagingListener {
|
||||||
|
void searchStats(AccountStats stats);
|
||||||
|
|
||||||
public void accountStatusChanged(BaseAccount account, AccountStats stats) {}
|
void accountStatusChanged(BaseAccount account, AccountStats stats);
|
||||||
|
void accountSizeChanged(Account account, long oldSize, long newSize);
|
||||||
|
|
||||||
public void accountSizeChanged(Account account, long oldSize, long newSize) {}
|
void listFoldersStarted(Account account);
|
||||||
|
void listFolders(Account account, List<LocalFolder> folders);
|
||||||
|
void listFoldersFinished(Account account);
|
||||||
|
void listFoldersFailed(Account account, String message);
|
||||||
|
|
||||||
|
void listLocalMessagesStarted(Account account, String folder);
|
||||||
|
void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages);
|
||||||
|
void listLocalMessagesUpdateMessage(Account account, String folder, Message message);
|
||||||
|
void listLocalMessagesRemoveMessage(Account account, String folder, Message message);
|
||||||
|
void listLocalMessagesFinished(Account account, String folder);
|
||||||
|
void listLocalMessagesFailed(Account account, String folder, String message);
|
||||||
|
|
||||||
public void listFoldersStarted(Account account) {}
|
void synchronizeMailboxStarted(Account account, String folder);
|
||||||
|
void synchronizeMailboxHeadersStarted(Account account, String folder);
|
||||||
|
void synchronizeMailboxHeadersProgress(Account account, String folder, int completed, int total);
|
||||||
|
void synchronizeMailboxHeadersFinished(Account account, String folder, int totalMessagesInMailbox,
|
||||||
|
int numNewMessages);
|
||||||
|
void synchronizeMailboxProgress(Account account, String folder, int completed, int total);
|
||||||
|
void synchronizeMailboxNewMessage(Account account, String folder, Message message);
|
||||||
|
void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message);
|
||||||
|
void synchronizeMailboxRemovedMessage(Account account, String folder, Message message);
|
||||||
|
void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages);
|
||||||
|
void synchronizeMailboxFailed(Account account, String folder, String message);
|
||||||
|
|
||||||
public void listFolders(Account account, List<LocalFolder> folders) {}
|
void loadMessageRemoteFinished(Account account, String folder, String uid);
|
||||||
|
void loadMessageRemoteFailed(Account account, String folder, String uid, Throwable t);
|
||||||
|
|
||||||
public void listFoldersFinished(Account account) {}
|
void checkMailStarted(Context context, Account account);
|
||||||
|
void checkMailFinished(Context context, Account account);
|
||||||
|
void checkMailFailed(Context context, Account account, String reason);
|
||||||
|
|
||||||
public void listFoldersFailed(Account account, String message) {}
|
void sendPendingMessagesStarted(Account account);
|
||||||
|
void sendPendingMessagesCompleted(Account account);
|
||||||
|
void sendPendingMessagesFailed(Account account);
|
||||||
|
|
||||||
|
void emptyTrashCompleted(Account account);
|
||||||
|
|
||||||
public void listLocalMessagesStarted(Account account, String folder) {}
|
void folderStatusChanged(Account account, String folderName, int unreadMessageCount);
|
||||||
|
void systemStatusChanged();
|
||||||
|
|
||||||
public void listLocalMessagesAddMessages(Account account, String folder,
|
void messageDeleted(Account account, String folder, Message message);
|
||||||
List<LocalMessage> messages) {}
|
void messageUidChanged(Account account, String folder, String oldUid, String newUid);
|
||||||
|
|
||||||
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {}
|
void setPushActive(Account account, String folderName, boolean enabled);
|
||||||
|
|
||||||
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {}
|
void loadAttachmentFinished(Account account, Message message, Part part);
|
||||||
|
void loadAttachmentFailed(Account account, Message message, Part part, String reason);
|
||||||
|
|
||||||
public void listLocalMessagesFinished(Account account, String folder) {}
|
void pendingCommandStarted(Account account, String commandTitle);
|
||||||
|
void pendingCommandsProcessing(Account account);
|
||||||
|
void pendingCommandCompleted(Account account, String commandTitle);
|
||||||
|
void pendingCommandsFinished(Account account);
|
||||||
|
|
||||||
public void listLocalMessagesFailed(Account account, String folder, String message) {}
|
void remoteSearchStarted(String folder);
|
||||||
|
void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults);
|
||||||
|
void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal);
|
||||||
public void synchronizeMailboxStarted(Account account, String folder) {}
|
void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults);
|
||||||
|
void remoteSearchFailed(String folder, String err);
|
||||||
public void synchronizeMailboxHeadersStarted(Account account, String folder) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxHeadersProgress(Account account, String folder,
|
|
||||||
int completed, int total) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxHeadersFinished(Account account, String folder,
|
|
||||||
int totalMessagesInMailbox, int numNewMessages) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxProgress(Account account, String folder, int completed,
|
|
||||||
int total) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder,
|
|
||||||
Message message) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxRemovedMessage(Account account, String folder,
|
|
||||||
Message message) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxFinished(Account account, String folder,
|
|
||||||
int totalMessagesInMailbox, int numNewMessages) {}
|
|
||||||
|
|
||||||
public void synchronizeMailboxFailed(Account account, String folder, String message) {}
|
|
||||||
|
|
||||||
public void loadMessageRemoteFinished(Account account, String folder, String uid) {}
|
|
||||||
|
|
||||||
public void loadMessageRemoteFailed(Account account, String folder, String uid,
|
|
||||||
Throwable t) {}
|
|
||||||
|
|
||||||
public void checkMailStarted(Context context, Account account) {}
|
|
||||||
|
|
||||||
public void checkMailFinished(Context context, Account account) {}
|
|
||||||
|
|
||||||
public void checkMailFailed(Context context, Account account, String reason) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void sendPendingMessagesStarted(Account account) {}
|
|
||||||
|
|
||||||
public void sendPendingMessagesCompleted(Account account) {}
|
|
||||||
|
|
||||||
public void sendPendingMessagesFailed(Account account) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void emptyTrashCompleted(Account account) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void systemStatusChanged() {}
|
|
||||||
|
|
||||||
|
|
||||||
public void messageDeleted(Account account, String folder, Message message) {}
|
|
||||||
|
|
||||||
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void setPushActive(Account account, String folderName, boolean enabled) {}
|
|
||||||
|
|
||||||
|
|
||||||
public void loadAttachmentFinished(Account account, Message message, Part part) {}
|
|
||||||
|
|
||||||
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void pendingCommandStarted(Account account, String commandTitle) {}
|
|
||||||
|
|
||||||
public void pendingCommandsProcessing(Account account) {}
|
|
||||||
|
|
||||||
public void pendingCommandCompleted(Account account, String commandTitle) {}
|
|
||||||
|
|
||||||
public void pendingCommandsFinished(Account account) {}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a remote search is started
|
|
||||||
*
|
|
||||||
* @param folder
|
|
||||||
*/
|
|
||||||
public void remoteSearchStarted(String folder) {}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when server has responded to our query. Messages have not yet been downloaded.
|
|
||||||
*
|
|
||||||
* @param numResults
|
|
||||||
*/
|
|
||||||
public void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults) { }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a new result message is available for a remote search
|
|
||||||
* Can assume headers have been downloaded, but potentially not body.
|
|
||||||
* @param folder
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
public void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when Remote Search is fully complete
|
|
||||||
* @param folder
|
|
||||||
* @param numResults
|
|
||||||
*/
|
|
||||||
public void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when there was a problem with a remote search operation.
|
|
||||||
* @param folder
|
|
||||||
* @param err
|
|
||||||
*/
|
|
||||||
public void remoteSearchFailed(String folder, String err) { }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General notification messages subclasses can override to be notified that the controller
|
* General notification messages subclasses can override to be notified that the controller
|
||||||
|
@ -179,7 +89,7 @@ public class MessagingListener {
|
||||||
* {@code true} if the controller will continue on to another command immediately.
|
* {@code true} if the controller will continue on to another command immediately.
|
||||||
* {@code false} otherwise.
|
* {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public void controllerCommandCompleted(boolean moreCommandsToRun) {}
|
void controllerCommandCompleted(boolean moreCommandsToRun);
|
||||||
|
|
||||||
public void enableProgressIndicator(boolean enable) { }
|
void enableProgressIndicator(boolean enable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,220 @@
|
||||||
|
|
||||||
|
package com.fsck.k9.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.fsck.k9.Account;
|
||||||
|
import com.fsck.k9.AccountStats;
|
||||||
|
import com.fsck.k9.BaseAccount;
|
||||||
|
import com.fsck.k9.mail.Message;
|
||||||
|
import com.fsck.k9.mail.Part;
|
||||||
|
import com.fsck.k9.mailstore.LocalFolder;
|
||||||
|
import com.fsck.k9.mailstore.LocalMessage;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
|
@Override
|
||||||
|
public void searchStats(AccountStats stats) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accountStatusChanged(BaseAccount account, AccountStats stats) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accountSizeChanged(Account account, long oldSize, long newSize) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listFoldersStarted(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listFolders(Account account, List<LocalFolder> folders) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listFoldersFinished(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listFoldersFailed(Account account, String message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesStarted(Account account, String folder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesFinished(Account account, String folder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void listLocalMessagesFailed(Account account, String folder, String message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxHeadersStarted(Account account, String folder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxHeadersProgress(Account account, String folder, int completed, int total) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxHeadersFinished(Account account, String folder, int totalMessagesInMailbox,
|
||||||
|
int numNewMessages) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxProgress(Account account, String folder, int completed, int total) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox,
|
||||||
|
int numNewMessages) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void synchronizeMailboxFailed(Account account, String folder, String message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadMessageRemoteFinished(Account account, String folder, String uid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadMessageRemoteFailed(Account account, String folder, String uid, Throwable t) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkMailStarted(Context context, Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkMailFinished(Context context, Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkMailFailed(Context context, Account account, String reason) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPendingMessagesStarted(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPendingMessagesCompleted(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPendingMessagesFailed(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void emptyTrashCompleted(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void systemStatusChanged() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void messageDeleted(Account account, String folder, Message message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPushActive(Account account, String folderName, boolean enabled) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadAttachmentFinished(Account account, Message message, Part part) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingCommandStarted(Account account, String commandTitle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingCommandsProcessing(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingCommandCompleted(Account account, String commandTitle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingCommandsFinished(Account account) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remoteSearchStarted(String folder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remoteSearchFailed(String folder, String err) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void controllerCommandCompleted(boolean moreCommandsToRun) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableProgressIndicator(boolean enable) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ import com.fsck.k9.activity.FolderInfoHolder;
|
||||||
import com.fsck.k9.activity.MessageInfoHolder;
|
import com.fsck.k9.activity.MessageInfoHolder;
|
||||||
import com.fsck.k9.activity.MessageReference;
|
import com.fsck.k9.activity.MessageReference;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.helper.MessageHelper;
|
import com.fsck.k9.helper.MessageHelper;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
|
@ -79,7 +79,7 @@ public class MessageProvider extends ContentProvider {
|
||||||
UnreadColumns.UNREAD
|
UnreadColumns.UNREAD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
|
private UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
|
||||||
private List<QueryHandler> queryHandlers = new ArrayList<QueryHandler>();
|
private List<QueryHandler> queryHandlers = new ArrayList<QueryHandler>();
|
||||||
private MessageHelper messageHelper;
|
private MessageHelper messageHelper;
|
||||||
|
@ -91,7 +91,7 @@ public class MessageProvider extends ContentProvider {
|
||||||
|
|
||||||
ScheduledExecutorService scheduledPool = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService scheduledPool = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreate() {
|
public boolean onCreate() {
|
||||||
messageHelper = MessageHelper.getInstance(getContext());
|
messageHelper = MessageHelper.getInstance(getContext());
|
||||||
|
@ -105,7 +105,7 @@ public class MessageProvider extends ContentProvider {
|
||||||
public void initializeComponent(final Application application) {
|
public void initializeComponent(final Application application) {
|
||||||
Log.v(K9.LOG_TAG, "Registering content resolver notifier");
|
Log.v(K9.LOG_TAG, "Registering content resolver notifier");
|
||||||
|
|
||||||
MessagingController.getInstance(application).addListener(new MessagingListener() {
|
MessagingController.getInstance(application).addListener(new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
||||||
application.getContentResolver().notifyChange(CONTENT_URI, null);
|
application.getContentResolver().notifyChange(CONTENT_URI, null);
|
||||||
|
@ -242,7 +242,7 @@ public class MessageProvider extends ContentProvider {
|
||||||
uriMatcher.addURI(AUTHORITY, handler.getPath(), code);
|
uriMatcher.addURI(AUTHORITY, handler.getPath(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class ReverseDateComparator implements Comparator<MessageInfoHolder> {
|
public static class ReverseDateComparator implements Comparator<MessageInfoHolder> {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MessageInfoHolder object2, MessageInfoHolder object1) {
|
public int compare(MessageInfoHolder object2, MessageInfoHolder object1) {
|
||||||
|
@ -1089,7 +1089,7 @@ public class MessageProvider extends ContentProvider {
|
||||||
/**
|
/**
|
||||||
* Synchronized listener used to retrieve {@link MessageInfoHolder}s using a given {@link BlockingQueue}.
|
* Synchronized listener used to retrieve {@link MessageInfoHolder}s using a given {@link BlockingQueue}.
|
||||||
*/
|
*/
|
||||||
protected class MessageInfoHolderRetrieverListener extends MessagingListener {
|
protected class MessageInfoHolderRetrieverListener extends SimpleMessagingListener {
|
||||||
private final BlockingQueue<List<MessageInfoHolder>> queue;
|
private final BlockingQueue<List<MessageInfoHolder>> queue;
|
||||||
private List<MessageInfoHolder> holders = new ArrayList<MessageInfoHolder>();
|
private List<MessageInfoHolder> holders = new ArrayList<MessageInfoHolder>();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.os.PowerManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.fsck.k9.*;
|
import com.fsck.k9.*;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager;
|
import com.fsck.k9.mail.power.TracingPowerManager;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class PollService extends CoreService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Listener extends MessagingListener {
|
class Listener extends SimpleMessagingListener {
|
||||||
Map<String, Integer> accountsChecked = new HashMap<String, Integer>();
|
Map<String, Integer> accountsChecked = new HashMap<String, Integer>();
|
||||||
private TracingWakeLock wakeLock = null;
|
private TracingWakeLock wakeLock = null;
|
||||||
private int startId = -1;
|
private int startId = -1;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.fsck.k9.Preferences;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.cache.TemporaryAttachmentStore;
|
import com.fsck.k9.cache.TemporaryAttachmentStore;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.SimpleMessagingListener;
|
||||||
import com.fsck.k9.helper.FileHelper;
|
import com.fsck.k9.helper.FileHelper;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
|
@ -97,7 +97,7 @@ public class AttachmentController {
|
||||||
LocalMessage message = localPart.getMessage();
|
LocalMessage message = localPart.getMessage();
|
||||||
|
|
||||||
messageViewFragment.showAttachmentLoadingDialog();
|
messageViewFragment.showAttachmentLoadingDialog();
|
||||||
controller.loadAttachment(account, message, attachment.part, new MessagingListener() {
|
controller.loadAttachment(account, message, attachment.part, new SimpleMessagingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void loadAttachmentFinished(Account account, Message message, Part part) {
|
public void loadAttachmentFinished(Account account, Message message, Part part) {
|
||||||
messageViewFragment.hideAttachmentLoadingDialogOnMainThread();
|
messageViewFragment.hideAttachmentLoadingDialogOnMainThread();
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class MessagingControllerTest {
|
||||||
@Mock
|
@Mock
|
||||||
private AccountStats accountStats;
|
private AccountStats accountStats;
|
||||||
@Mock
|
@Mock
|
||||||
private MessagingListener listener;
|
private SimpleMessagingListener listener;
|
||||||
@Mock
|
@Mock
|
||||||
private LocalSearch search;
|
private LocalSearch search;
|
||||||
@Mock
|
@Mock
|
||||||
|
|
Loading…
Reference in a new issue