mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -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:
parent
357ff33133
commit
4e53ee12b6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user