diff --git a/src/org/yaaic/adapter/MessageListAdapter.java b/src/org/yaaic/adapter/MessageListAdapter.java index f903e14..afc30d8 100644 --- a/src/org/yaaic/adapter/MessageListAdapter.java +++ b/src/org/yaaic/adapter/MessageListAdapter.java @@ -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(); } diff --git a/src/org/yaaic/model/Conversation.java b/src/org/yaaic/model/Conversation.java index 01e08ef..569510e 100644 --- a/src/org/yaaic/model/Conversation.java +++ b/src/org/yaaic/model/Conversation.java @@ -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 buffer; private List history;