mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 08:52:18 -05:00
Remove old messages from the conversation view if messages.count() > HISTORY_SIZE
This commit is contained in:
parent
11eabc723e
commit
63fa7910d0
@ -78,6 +78,11 @@ public class MessageListAdapter extends BaseAdapter
|
||||
public synchronized void addMessage(Message message)
|
||||
{
|
||||
messages.add(message.renderTextView(context));
|
||||
|
||||
if (messages.size() > Conversation.HISTORY_SIZE) {
|
||||
messages.remove(0);
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public abstract class Conversation
|
||||
public static final int TYPE_QUERY = 2;
|
||||
public static final int TYPE_SERVER = 3;
|
||||
|
||||
private static final int HISTORY_SIZE = 30;
|
||||
public static final int HISTORY_SIZE = 30;
|
||||
|
||||
private List<Message> buffer;
|
||||
private List<Message> history;
|
||||
|
Loading…
Reference in New Issue
Block a user