mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 19:02:17 -05:00
MessageListAdapter: Add a bunch of messages via addBulkMessages()
This commit is contained in:
parent
6996b4acee
commit
3c5cad2c46
@ -90,6 +90,28 @@ public class MessageListAdapter extends BaseAdapter
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a list of messages to the list
|
||||
*
|
||||
* @param messages
|
||||
*/
|
||||
public void addBulkMessages(LinkedList<Message> messages)
|
||||
{
|
||||
LinkedList<TextView> mMessages = this.messages;
|
||||
Context mContext = this.context;
|
||||
int mSize = messages.size();
|
||||
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
mMessages.add(messages.get(i).renderTextView(mContext));
|
||||
|
||||
if (mMessages.size() > Conversation.HISTORY_SIZE) {
|
||||
mMessages.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of items
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user