changed design language to match BTBV proposal

* untrusted messages have red background
* unverified message have normal background and red lock
This commit is contained in:
Daniel Gultsch 2016-11-24 11:29:26 +01:00
parent 2ec7165381
commit cbd45d3ee5
3 changed files with 14 additions and 8 deletions

View File

@ -493,7 +493,7 @@ public class Message extends AbstractEntity {
!this.getBody().startsWith(ME_COMMAND) && !this.getBody().startsWith(ME_COMMAND) &&
!this.bodyIsHeart() && !this.bodyIsHeart() &&
!message.bodyIsHeart() && !message.bodyIsHeart() &&
this.isTrusted() == message.isTrusted() ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint()))
); );
} }
@ -813,7 +813,7 @@ public class Message extends AbstractEntity {
public boolean isTrusted() { public boolean isTrusted() {
FingerprintStatus s = conversation.getAccount().getAxolotlService().getFingerprintTrust(axolotlFingerprint); FingerprintStatus s = conversation.getAccount().getAxolotlService().getFingerprintTrust(axolotlFingerprint);
return s != null && s.isTrustedAndActive(); return s != null && s.isTrusted();
} }
private int getPreviousEncryption() { private int getPreviousEncryption() {

View File

@ -128,7 +128,7 @@ public class MessageAdapter extends ArrayAdapter<Message> 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 filesize = null;
String info = null; String info = null;
boolean error = false; boolean error = false;
@ -208,8 +208,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
.getAccount().getAxolotlService().getFingerprintTrust( .getAccount().getAxolotlService().getFingerprintTrust(
message.getFingerprint()); message.getFingerprint());
if(status == null || (!status.isTrustedAndActive())) { if(status == null || (!status.isVerified() && inValidSession)) {
viewHolder.indicator.setColorFilter(activity.getWarningTextColor()); viewHolder.indicator.setColorFilter(0xffc64545);
viewHolder.indicator.setAlpha(1.0f); viewHolder.indicator.setAlpha(1.0f);
} else { } else {
viewHolder.indicator.clearColorFilter(); viewHolder.indicator.clearColorFilter();
@ -465,7 +465,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
@Override @Override
public View getView(int position, View view, ViewGroup parent) { public View getView(int position, View view, ViewGroup parent) {
final Message message = getItem(position); 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 Conversation conversation = message.getConversation();
final Account account = conversation.getAccount(); final Account account = conversation.getAccount();
final int type = getItemViewType(position); final int type = getItemViewType(position);
@ -671,11 +672,15 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else { } else {
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning); viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
viewHolder.encryption.setVisibility(View.VISIBLE); viewHolder.encryption.setVisibility(View.VISIBLE);
if (omemoEncryption && !message.isTrusted()) {
viewHolder.encryption.setText(R.string.not_trusted);
} else {
viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption())); viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption()));
} }
} }
}
displayStatus(viewHolder, message, type, darkBackground); displayStatus(viewHolder, message, type, darkBackground, isInValidSession);
return view; return view;
} }

View File

@ -713,4 +713,5 @@
<string name="pref_blind_trust_before_verification">Blind Trust Before Verification</string> <string name="pref_blind_trust_before_verification">Blind Trust Before Verification</string>
<string name="pref_blind_trust_before_verification_summary">Automatically trust all new devices from contacts that havent been verified before.</string> <string name="pref_blind_trust_before_verification_summary">Automatically trust all new devices from contacts that havent been verified before.</string>
<string name="blindly_trusted_omemo_keys">Blindly trusted OMEMO keys</string> <string name="blindly_trusted_omemo_keys">Blindly trusted OMEMO keys</string>
<string name="not_trusted">Untrusted</string>
</resources> </resources>