diff options
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 2dd8a0495..413e3d626 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 5e5cfbe40..26e646ff4 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; |