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.clear();
int selectedFolder = -1;
int position = 0;
for (String name : localFolders)
{
if (K9.INBOX.equalsIgnoreCase(name))
{
mAdapter.add(getString(R.string.special_mailbox_name_inbox));
heldInbox = name;
}
else if (!K9.ERROR_FOLDER_NAME.equals(name))
{
mAdapter.add(name);
}
try {
mAdapter.clear();
int position = 0;
for (String name : localFolders)
{
if (K9.INBOX.equalsIgnoreCase(name))
{
mAdapter.add(getString(R.string.special_mailbox_name_inbox));
heldInbox = name;
}
else if (!K9.ERROR_FOLDER_NAME.equals(name))
{
mAdapter.add(name);
}
if (mSelectFolder != null)
{
/*
* Never select EXTRA_CUR_FOLDER (mFolder) if EXTRA_SEL_FOLDER
* (mSelectedFolder) was provided.
*/
if (mSelectFolder != null)
{
/*
* Never select EXTRA_CUR_FOLDER (mFolder) if EXTRA_SEL_FOLDER
* (mSelectedFolder) was provided.
*/
if (name.equals(mSelectFolder))
{
selectedFolder = position;
}
}
else if (name.equals(mFolder) ||
(K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name)))
{
selectedFolder = position;
}
position++;
if (name.equals(mSelectFolder))
{
selectedFolder = position;
}
}
else if (name.equals(mFolder) ||
(K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name)))
{
selectedFolder = position;
}
position++;
}
} finally {
mAdapter.setNotifyOnChange(true);
runOnUiThread(new Runnable() {
public void run() {
// runOnUiThread(
mAdapter.notifyDataSetChanged();
}
});
}
mHandler.dataChanged();