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(); 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() { public boolean wasMergedIntoPrevious() {
Message prev = this.prev(); Message prev = this.prev();
if (prev == null) { if (prev == null) {

View file

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