From e75acffa61b46a6320ca0341252b720b0609536b Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 24 Nov 2016 21:53:43 +0100 Subject: changed design language to match BTBV proposal * untrusted messages have red background * unverified messages have normal background and red lock --- src/main/java/de/pixart/messenger/entities/Message.java | 4 ++-- .../de/pixart/messenger/ui/adapter/MessageAdapter.java | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 4224f6d6f..14120908f 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -495,7 +495,7 @@ public class Message extends AbstractEntity { !message.bodyIsHeart() && !this.bodyIsXmpp() && !message.bodyIsXmpp() && - this.isTrusted() == message.isTrusted() + ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) ); } @@ -819,7 +819,7 @@ public class Message extends AbstractEntity { public boolean isTrusted() { FingerprintStatus s = conversation.getAccount().getAxolotlService().getFingerprintTrust(axolotlFingerprint); - return s != null && s.isTrustedAndActive(); + return s != null && s.isTrusted(); } private int getPreviousEncryption() { diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 6cf16fdd5..6939ad1d7 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -141,7 +141,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } - private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground) { + private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground, boolean inValidSession) { String filesize = null; String info = null; boolean error = false; @@ -224,8 +224,8 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie .getAccount().getAxolotlService().getFingerprintTrust( message.getFingerprint()); - if (status == null || (!status.isTrustedAndActive())) { - viewHolder.indicator.setColorFilter(activity.getWarningTextColor()); + if(status == null || (!status.isVerified() && inValidSession)) { + viewHolder.indicator.setColorFilter(0xffc64545); viewHolder.indicator.setAlpha(1.0f); } else { viewHolder.indicator.clearColorFilter(); @@ -582,7 +582,8 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie @Override public View getView(int position, View unused, ViewGroup parent) { final Message message = getItem(position); - final boolean isInValidSession = message.isValidInSession(); + final boolean omemoEncryption = message.getEncryption() == Message.ENCRYPTION_AXOLOTL; + final boolean isInValidSession = message.isValidInSession() && (!omemoEncryption || message.isTrusted()); final Conversation conversation = message.getConversation(); final Account account = conversation.getAccount(); final int type = getItemViewType(position); @@ -793,7 +794,11 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } else { viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning); viewHolder.encryption.setVisibility(View.VISIBLE); - viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption())); + if (omemoEncryption && !message.isTrusted()) { + viewHolder.encryption.setText(R.string.not_trusted); + } else { + viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption())); + } } } @@ -805,7 +810,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } - displayStatus(viewHolder, message, type, darkBackground); + displayStatus(viewHolder, message, type, darkBackground, isInValidSession); return view; } -- cgit v1.2.3