show merged time and status in message adapter

This commit is contained in:
iNPUTmice 2014-08-31 18:55:15 +02:00
parent bda7724e31
commit 94389ac22a
2 changed files with 21 additions and 3 deletions

View File

@ -337,6 +337,24 @@ public class Message extends AbstractEntity {
return body.trim();
}
public int getMergedStatus() {
Message next = this.next();
if (this.mergable(next)) {
return next.getMergedStatus();
} else {
return getStatus();
}
}
public long getMergedTimeSent() {
Message next = this.next();
if (this.mergable(next)) {
return next.getMergedTimeSent();
} else {
return getTimeSent();
}
}
public boolean wasMergedIntoPrevious() {
Message prev = this.prev();
if (prev == null) {

View File

@ -96,7 +96,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
String info = null;
boolean error = false;
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
&& message.getStatus() <= Message.STATUS_RECEIVED;
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
if (message.getType() == Message.TYPE_IMAGE) {
String[] fileParams = message.getBody().split(",");
try {
@ -106,7 +106,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
filesize = "0 KB";
}
}
switch (message.getStatus()) {
switch (message.getMergedStatus()) {
case Message.STATUS_WAITING:
info = getContext().getString(R.string.waiting);
break;
@ -154,7 +154,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
String formatedTime = UIHelper.readableTimeDifference(getContext(),
message.getTimeSent());
message.getMergedTimeSent());
if (message.getStatus() <= Message.STATUS_RECEIVED) {
if ((filesize != null) && (info != null)) {
viewHolder.time.setText(filesize + " \u00B7 " + info);