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

Fix phantom messages in unified inbox.

This commit is contained in:
Jesse Vincent 2010-10-23 15:19:56 +00:00
parent bc2127c84a
commit 96f1d9eadf

View File

@ -771,51 +771,65 @@ public class MessageList
sortDateAscending = mController.isSortAscending(SORT_TYPE.SORT_DATE); sortDateAscending = mController.isSortAscending(SORT_TYPE.SORT_DATE);
mController.addListener(mAdapter.mListener); mController.addListener(mAdapter.mListener);
if (mAccount != null)
if (mFolderName != null)
{ {
if (mAdapter.messages.isEmpty()) mController.notifyAccountCancel(this, mAccount);
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
}
if (mAdapter.messages.isEmpty())
{
if (mFolderName != null)
{ {
mController.listLocalMessages(mAccount, mFolderName, mAdapter.mListener); mController.listLocalMessages(mAccount, mFolderName, mAdapter.mListener);
} }
else else if (mQueryString != null)
{ {
new Thread() mController.searchLocalMessages(mAccountUuids, mFolderNames, null, mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags, mAdapter.mListener);
}
}
else
{
new Thread()
{
@Override
public void run()
{ {
@Override mAdapter.markAllMessagesAsDirty();
public void run()
if (mFolderName != null)
{ {
mAdapter.markAllMessagesAsDirty();
mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener); mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener);
mAdapter.pruneDirtyMessages(); }
runOnUiThread(new Runnable() else if (mQueryString != null)
{ {
public void run() mController.searchLocalMessagesSynchronous(mAccountUuids, mFolderNames, null, mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags, mAdapter.mListener);
{
mAdapter.notifyDataSetChanged();
}
});
} }
mAdapter.pruneDirtyMessages();
runOnUiThread(new Runnable()
{
public void run()
{
mAdapter.notifyDataSetChanged();
restoreListState();
}
});
} }
.start();
} }
mController.notifyAccountCancel(this, mAccount); .start();
}
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
if (mAccount != null && mFolderName != null)
{
mController.getFolderUnreadMessageCount(mAccount, mFolderName, mAdapter.mListener); mController.getFolderUnreadMessageCount(mAccount, mFolderName, mAdapter.mListener);
} }
else if (mQueryString != null)
{
mController.searchLocalMessages(mAccountUuids, mFolderNames, null, mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags, mAdapter.mListener);
}
mHandler.refreshTitle(); mHandler.refreshTitle();
restoreListState();
} }
private void initializeLayout() private void initializeLayout()
{ {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);