1
0
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:
Sebastian Kaspari 2010-03-14 00:04:18 +01:00
parent 11eabc723e
commit 63fa7910d0
2 changed files with 6 additions and 1 deletions

View File

@ -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();
}

View File

@ -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;