aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index f55094af..c44796ba 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -560,6 +560,36 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
}
+ if (type == RECEIVED) {
+ boolean wasEncrypted = false;
+ for (Message iterator = message.prev(); iterator != null; iterator = iterator.prev()){
+ if (iterator.getEncryption() != Message.ENCRYPTION_NONE) {
+ wasEncrypted = true;
+ break;
+ }
+ if (iterator.getRemoteMsgId() == null && iterator.getType() == SENT) {
+ break;
+ }
+ }
+ boolean willBeEncrypted = conversation.getNextEncryption(false) != Message.ENCRYPTION_NONE;
+ for (Message iterator = message.next(); iterator != null; iterator = iterator.next()){
+ if (iterator.getEncryption() != Message.ENCRYPTION_NONE) {
+ willBeEncrypted = true;
+ break;
+ }
+ if (iterator.getRemoteMsgId() == null && iterator.getType() == SENT) {
+ break;
+ }
+ }
+
+ if ( willBeEncrypted && wasEncrypted
+ && message.getEncryption() == Message.ENCRYPTION_NONE) {
+ viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
+ } else {
+ viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received);
+ }
+ }
+
displayStatus(viewHolder, message);
return view;