1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Extract out the listener we're using when we ask for new messages.

It may eventually get further extracted.
This commit is contained in:
Jesse Vincent 2009-12-27 16:51:45 +00:00
parent 9d417133b5
commit 94e61ab62c

View File

@ -546,14 +546,7 @@ public class MessagingController implements Runnable
}
Folder localFolder = null;
try
{
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
localFolder = localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
localFolder.getMessages(
MessageRetrievalListener retrievalListener =
new MessageRetrievalListener()
{
List<Message> pendingMessages = new ArrayList<Message>();
@ -572,7 +565,7 @@ public class MessagingController implements Runnable
totalDone++;
if (pendingMessages.size() > 10)
{
callbackPending();
addPendingMessages();
}
}
@ -591,9 +584,9 @@ public class MessagingController implements Runnable
}
public void messagesFinished(int number)
{
callbackPending();
addPendingMessages();
}
private void callbackPending()
private void addPendingMessages()
{
for (MessagingListener l : getListeners())
{
@ -605,7 +598,18 @@ public class MessagingController implements Runnable
}
pendingMessages.clear();
}
},
};
try
{
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
localFolder = localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
localFolder.getMessages(
retrievalListener,
false // Skip deleted messages
);
if (K9.DEBUG)