mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-29 12:22:21 -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)
|
public synchronized void addMessage(Message message)
|
||||||
{
|
{
|
||||||
messages.add(message.renderTextView(context));
|
messages.add(message.renderTextView(context));
|
||||||
|
|
||||||
|
if (messages.size() > Conversation.HISTORY_SIZE) {
|
||||||
|
messages.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public abstract class Conversation
|
|||||||
public static final int TYPE_QUERY = 2;
|
public static final int TYPE_QUERY = 2;
|
||||||
public static final int TYPE_SERVER = 3;
|
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> buffer;
|
||||||
private List<Message> history;
|
private List<Message> history;
|
||||||
|
Loading…
Reference in New Issue
Block a user