aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/entities/Conversation.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-10 22:45:59 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-10 22:45:59 +0100
commitb673af2ba0b46e7444f536fbc7429f9ef74560fb (patch)
treef33e36a559d3a2b574c25962579fa161f1f968d8 /src/de/gultsch/chat/entities/Conversation.java
parentcfc74e7c8e912c7a194ad674ec5f98ab6950640f (diff)
reworked notification a bit
Diffstat (limited to 'src/de/gultsch/chat/entities/Conversation.java')
-rw-r--r--src/de/gultsch/chat/entities/Conversation.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/de/gultsch/chat/entities/Conversation.java b/src/de/gultsch/chat/entities/Conversation.java
index 8be35aa4..bddd1356 100644
--- a/src/de/gultsch/chat/entities/Conversation.java
+++ b/src/de/gultsch/chat/entities/Conversation.java
@@ -6,6 +6,7 @@ import java.util.List;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
+import android.util.Log;
public class Conversation extends AbstractEntity {
@@ -71,6 +72,20 @@ public class Conversation extends AbstractEntity {
return messages;
}
+ public boolean isRead() {
+ if (this.messages == null) return true;
+ return this.messages.get(this.messages.size() - 1).isRead();
+ }
+
+ public void markRead() {
+ Log.d("xmppService", "inside mark read method");
+ if (this.messages == null) return;
+ for(int i = this.messages.size() -1; i >= 0; --i) {
+ if (messages.get(i).isRead()) return;
+ this.messages.get(i).markRead();
+ }
+ }
+
public String getLatestMessage() {
if ((this.messages == null)||(this.messages.size()==0)) {
return null;
@@ -121,7 +136,9 @@ public class Conversation extends AbstractEntity {
public void setContact(Contact contact) {
this.contact = contact;
- this.contactUuid = contact.getUuid();
+ if (contact!=null) {
+ this.contactUuid = contact.getUuid();
+ }
}
public void setAccount(Account account) {
@@ -151,7 +168,7 @@ public class Conversation extends AbstractEntity {
ContentValues values = new ContentValues();
values.put(UUID, uuid);
values.put(NAME, name);
- values.put(CONTACT, contact.getUuid());
+ values.put(CONTACT, contactUuid);
values.put(ACCOUNT, accountUuid);
values.put(CONTACTJID, contactJid);
values.put(CREATED, created);