diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-01-26 03:27:55 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-01-26 03:27:55 +0100 |
commit | 898b0ca8c485888e06e2b5b1c798eebce1a6dabc (patch) | |
tree | f737883fd44da0270ed5ae0f76560d202d55ff24 /src/de/gultsch/chat/entities | |
parent | 665ef7511f5dcccb349228baa2aa6f02281d3c07 (diff) |
chat bubbles. yeah
Diffstat (limited to 'src/de/gultsch/chat/entities')
-rw-r--r-- | src/de/gultsch/chat/entities/Conversation.java | 11 | ||||
-rw-r--r-- | src/de/gultsch/chat/entities/Message.java | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/de/gultsch/chat/entities/Conversation.java b/src/de/gultsch/chat/entities/Conversation.java index 2dd8a049..413e3d62 100644 --- a/src/de/gultsch/chat/entities/Conversation.java +++ b/src/de/gultsch/chat/entities/Conversation.java @@ -1,5 +1,6 @@ package de.gultsch.chat.entities; +import java.util.ArrayList; import java.util.List; import android.content.ContentValues; @@ -9,6 +10,9 @@ import android.net.Uri; public class Conversation extends AbstractEntity { private static final long serialVersionUID = -6727528868973996739L; + + public static final String TABLENAME = "conversations"; + public static final int STATUS_AVAILABLE = 0; public static final int STATUS_ARCHIVED = 1; public static final int STATUS_DELETED = 2; @@ -27,7 +31,7 @@ public class Conversation extends AbstractEntity { private int status; private long created; - private transient List<Message> messages; + private transient List<Message> messages = null; public Conversation(String name, Uri profilePhoto, Account account, String contactJid) { @@ -48,6 +52,7 @@ public class Conversation extends AbstractEntity { } public List<Message> getMessages() { + if (messages == null) this.messages = new ArrayList<Message>(); //prevent null pointer return messages; } @@ -81,6 +86,10 @@ public class Conversation extends AbstractEntity { public int getStatus() { return this.status; } + + public long getCreated() { + return this.created; + } public ContentValues getContentValues() { ContentValues values = new ContentValues(); diff --git a/src/de/gultsch/chat/entities/Message.java b/src/de/gultsch/chat/entities/Message.java index 5e5cfbe4..26e646ff 100644 --- a/src/de/gultsch/chat/entities/Message.java +++ b/src/de/gultsch/chat/entities/Message.java @@ -6,6 +6,8 @@ import android.database.Cursor; public class Message extends AbstractEntity { private static final long serialVersionUID = 7222081895167103025L; + + public static final String TABLENAME = "messages"; public static final int STATUS_RECIEVED = 0; public static final int STATUS_UNSEND = 1; |