1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-04 16:45:09 -05:00

Update issue 2479

possible fix for "The content of the adapter has changed but ListView did not receive a notification."
This commit is contained in:
Marcus Wolschon 2011-01-18 15:34:41 +00:00
parent 951dbcbd33
commit 60ea4c6ce7

View File

@ -341,39 +341,49 @@ public class ChooseFolder extends K9ListActivity
} }
}); });
mAdapter.setNotifyOnChange(false); mAdapter.setNotifyOnChange(false);
mAdapter.clear();
int selectedFolder = -1; int selectedFolder = -1;
int position = 0; try {
for (String name : localFolders) mAdapter.clear();
{ int position = 0;
if (K9.INBOX.equalsIgnoreCase(name)) for (String name : localFolders)
{ {
mAdapter.add(getString(R.string.special_mailbox_name_inbox)); if (K9.INBOX.equalsIgnoreCase(name))
heldInbox = name; {
} mAdapter.add(getString(R.string.special_mailbox_name_inbox));
else if (!K9.ERROR_FOLDER_NAME.equals(name)) heldInbox = name;
{ }
mAdapter.add(name); else if (!K9.ERROR_FOLDER_NAME.equals(name))
} {
mAdapter.add(name);
}
if (mSelectFolder != null) if (mSelectFolder != null)
{ {
/* /*
* Never select EXTRA_CUR_FOLDER (mFolder) if EXTRA_SEL_FOLDER * Never select EXTRA_CUR_FOLDER (mFolder) if EXTRA_SEL_FOLDER
* (mSelectedFolder) was provided. * (mSelectedFolder) was provided.
*/ */
if (name.equals(mSelectFolder)) if (name.equals(mSelectFolder))
{ {
selectedFolder = position; selectedFolder = position;
} }
} }
else if (name.equals(mFolder) || else if (name.equals(mFolder) ||
(K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name))) (K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name)))
{ {
selectedFolder = position; selectedFolder = position;
} }
position++; position++;
}
} finally {
mAdapter.setNotifyOnChange(true);
runOnUiThread(new Runnable() {
public void run() {
// runOnUiThread(
mAdapter.notifyDataSetChanged();
}
});
} }
mHandler.dataChanged(); mHandler.dataChanged();