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

Experimental deletedUids list in FolderInfoHolder to avoid race

conditions when using instance delete
This commit is contained in:
Daniel Applebaum 2009-01-08 04:42:56 +00:00
parent 2b01f96e4e
commit 7954b02da6

View File

@ -5,6 +5,8 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import android.app.ExpandableListActivity;
import android.app.NotificationManager;
@ -1223,6 +1225,10 @@ public class FolderMessageList extends ExpandableListActivity
{
return;
}
FolderInfoHolder holder = getFolder(folder);
if (holder != null) {
holder.deletedUids.clear();
}
mHandler.progress(false);
mHandler.folderLoading(folder, false);
// mHandler.folderStatus(folder, null);
@ -1239,6 +1245,8 @@ public class FolderMessageList extends ExpandableListActivity
{
return;
}
mHandler.progress(false);
mHandler.folderLoading(folder, false);
@ -1249,6 +1257,7 @@ public class FolderMessageList extends ExpandableListActivity
if (holder != null)
{
holder.lastChecked = 0;
holder.deletedUids.clear();
}
mHandler.folderSyncing(null);
}
@ -1368,6 +1377,9 @@ public class FolderMessageList extends ExpandableListActivity
{
return;
}
if (f.deletedUids.contains(messageUid) == false) {
f.deletedUids.add(messageUid);
}
mHandler.removeMessage(f, m);
}
@ -1389,6 +1401,9 @@ public class FolderMessageList extends ExpandableListActivity
private void addOrUpdateMessage(FolderInfoHolder folder, Message message,
boolean sort, boolean notify)
{
if (folder.deletedUids.remove(message.getUid())){
return;
}
MessageInfoHolder m = getMessage(folder, message.getUid());
if (m == null)
{
@ -1738,7 +1753,8 @@ public class FolderMessageList extends ExpandableListActivity
public String status;
public boolean lastCheckFailed;
public List<String> deletedUids = Collections.synchronizedList(new ArrayList<String>());
/**
* Outbox is handled differently from any other folder.
*/