diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities/Message.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Message.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 544640ab0..d13e90743 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -10,6 +10,7 @@ import java.net.URL; import de.pixart.messenger.Config; import de.pixart.messenger.crypto.axolotl.FingerprintStatus; import de.pixart.messenger.http.AesGcmURLStreamHandler; +import de.pixart.messenger.ui.adapter.MessageAdapter; import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.GeoHelper; import de.pixart.messenger.utils.MimeUtils; @@ -190,13 +191,6 @@ public class Message extends AbstractEntity { cursor.getString(cursor.getColumnIndex(ERROR_MESSAGE))); } - public static Message createDateMessage(Conversation conversation, String body) { - final Message message = new Message(conversation); - message.setType(Message.TYPE_STATUS); - message.setBody(body); - return message; - } - public static Message createStatusMessage(Conversation conversation, String body) { final Message message = new Message(conversation); message.setType(Message.TYPE_STATUS); @@ -211,6 +205,14 @@ public class Message extends AbstractEntity { return message; } + public static Message createDateSeparator(Message message) { + final Message separator = new Message(message.getConversation()); + separator.setType(Message.TYPE_STATUS); + separator.setBody(MessageAdapter.DATE_SEPARATOR_BODY); + separator.setTime(message.getTimeSent()); + return separator; + } + @Override public ContentValues getContentValues() { ContentValues values = new ContentValues(); @@ -503,7 +505,8 @@ public class Message extends AbstractEntity { !message.bodyIsHeart() && !this.bodyIsXmpp() && !message.bodyIsXmpp() && - ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) + ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) && + UIHelper.sameDay(message.getTimeSent(), this.getTimeSent()) ); } |