Cut down on some unneccesary allocations
We were always allocating a one element array in a loop. We can just keep create one array and reuse it. Change-Id: Ia44f0b711ef48fb87030c3f09f3f9fb654717b7a
This commit is contained in:
parent
2127d4dd09
commit
1a0aa22dc0
@ -247,6 +247,7 @@ public class ImapService extends Service {
|
||||
FetchProfile fp = new FetchProfile();
|
||||
fp.add(FetchProfile.Item.STRUCTURE);
|
||||
remoteFolder.fetch(messages.toArray(new Message[messages.size()]), fp, null);
|
||||
Message [] oneMessageArray = new Message[1];
|
||||
for (Message message : messages) {
|
||||
// Build a list of parts we are interested in. Text parts will be downloaded
|
||||
// right now, attachments will be left for later.
|
||||
@ -254,10 +255,11 @@ public class ImapService extends Service {
|
||||
ArrayList<Part> attachments = new ArrayList<Part>();
|
||||
MimeUtility.collectParts(message, viewables, attachments);
|
||||
// Download the viewables immediately
|
||||
oneMessageArray[0] = message;
|
||||
for (Part part : viewables) {
|
||||
fp.clear();
|
||||
fp.add(part);
|
||||
remoteFolder.fetch(new Message[] { message }, fp, null);
|
||||
remoteFolder.fetch(oneMessageArray, fp, null);
|
||||
}
|
||||
// Store the updated message locally and mark it fully loaded
|
||||
Utilities.copyOneMessageToProvider(context, message, account, toMailbox,
|
||||
|
Loading…
Reference in New Issue
Block a user