mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-30 23:00:09 -05:00
Push a "is this the right folder?" check into our "add/remove messages from the message list, to better support search
This commit is contained in:
parent
81a5820e5d
commit
54ad16edb8
@ -152,11 +152,14 @@ public class MessageList
|
||||
{
|
||||
for (MessageInfoHolder message : messages)
|
||||
{
|
||||
if (message != null && message.selected && mSelectedCount > 0)
|
||||
if (mFolderName == null || message.folder.name.equals(mFolderName))
|
||||
{
|
||||
mSelectedCount--;
|
||||
if (message != null && message.selected && mSelectedCount > 0)
|
||||
{
|
||||
mSelectedCount--;
|
||||
}
|
||||
mAdapter.messages.remove(message);
|
||||
}
|
||||
mAdapter.messages.remove(message);
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
configureBatchButtons();
|
||||
@ -171,21 +174,26 @@ public class MessageList
|
||||
boolean wasEmpty = mAdapter.messages.isEmpty();
|
||||
for (final MessageInfoHolder message : messages)
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
|
||||
if (mFolderName == null || message.folder.name.equals(mFolderName))
|
||||
{
|
||||
public void run()
|
||||
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
int index = Collections.binarySearch(mAdapter.messages, message);
|
||||
|
||||
if (index < 0)
|
||||
public void run()
|
||||
{
|
||||
index = (index * -1) - 1;
|
||||
int index = Collections.binarySearch(mAdapter.messages, message);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
index = (index * -1) - 1;
|
||||
}
|
||||
|
||||
mAdapter.messages.add(index, message);
|
||||
|
||||
}
|
||||
|
||||
mAdapter.messages.add(index, message);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (wasEmpty)
|
||||
|
Loading…
Reference in New Issue
Block a user