1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

For the common case of "getMessage" where we actually have the object in

the list, use a less painful equality check than iteration.

This works because messageInfoHolders compare to each other using the
same key as message they contain.
This commit is contained in:
Jesse Vincent 2010-10-13 10:52:53 +00:00
parent 357ff33133
commit 4e53ee12b6

View File

@ -2396,7 +2396,19 @@ public class MessageList
}
public MessageInfoHolder getMessage(Message message)
{
return getMessage(message.makeMessageReference());
synchronized (mAdapter.messages)
{
int index = mAdapter.messages.indexOf(message);
if (index == -1)
{
return null;
}
else
{
return mAdapter.messages.get(index);
}
}
}
// XXX TODO - make this not use a for loop