mark used otr fingprint in contact details and highlight pgp

This commit is contained in:
Daniel Gultsch 2016-06-16 12:12:24 +02:00
parent 1eb776f39c
commit 48a7818e88
3 changed files with 28 additions and 4 deletions

View File

@ -419,8 +419,13 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
ImageButton removeButton = (ImageButton) view ImageButton removeButton = (ImageButton) view
.findViewById(R.id.button_remove); .findViewById(R.id.button_remove);
removeButton.setVisibility(View.VISIBLE); removeButton.setVisibility(View.VISIBLE);
keyType.setText("OTR Fingerprint");
key.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); key.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
if (otrFingerprint != null && otrFingerprint.equals(messageFingerprint)) {
keyType.setText(R.string.otr_fingerprint_selected_message);
keyType.setTextColor(getResources().getColor(R.color.accent));
} else {
keyType.setText(R.string.otr_fingerprint);
}
keys.addView(view); keys.addView(view);
removeButton.setOnClickListener(new OnClickListener() { removeButton.setOnClickListener(new OnClickListener() {
@ -447,7 +452,10 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
View view = inflater.inflate(R.layout.contact_key, keys, false); View view = inflater.inflate(R.layout.contact_key, keys, false);
TextView key = (TextView) view.findViewById(R.id.key); TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type); TextView keyType = (TextView) view.findViewById(R.id.key_type);
keyType.setText("PGP Key ID"); keyType.setText(R.string.openpgp_key_id);
if ("pgp".equals(messageFingerprint)) {
keyType.setTextColor(getResources().getColor(R.color.accent));
}
key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId())); key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId()));
view.setOnClickListener(new OnClickListener() { view.setOnClickListener(new OnClickListener() {

View File

@ -449,7 +449,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} }
} else { } else {
if (!message.getContact().isSelf()) { if (!message.getContact().isSelf()) {
activity.switchToContactDetails(message.getContact(), message.getFingerprint()); String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp";
} else {
fingerprint = message.getFingerprint();
}
activity.switchToContactDetails(message.getContact(), fingerprint);
} }
} }
} else { } else {
@ -461,7 +468,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} else { } else {
intent = new Intent(activity, EditAccountActivity.class); intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toBareJid().toString()); intent.putExtra("jid", account.getJid().toBareJid().toString());
intent.putExtra("fingerprint", message.getFingerprint()); String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp";
} else {
fingerprint = message.getFingerprint();
}
intent.putExtra("fingerprint", fingerprint);
} }
startActivity(intent); startActivity(intent);
} }

View File

@ -219,6 +219,8 @@
<string name="reception_failed">Reception failed</string> <string name="reception_failed">Reception failed</string>
<string name="your_fingerprint">Your fingerprint</string> <string name="your_fingerprint">Your fingerprint</string>
<string name="otr_fingerprint">OTR fingerprint</string> <string name="otr_fingerprint">OTR fingerprint</string>
<string name="otr_fingerprint_selected_message">OTR fingerprint of message</string>
<string name="openpgp_key_id">OpenPGP Key ID</string>
<string name="omemo_fingerprint">OMEMO fingerprint</string> <string name="omemo_fingerprint">OMEMO fingerprint</string>
<string name="omemo_fingerprint_x509">v\\OMEMO fingerprint</string> <string name="omemo_fingerprint_x509">v\\OMEMO fingerprint</string>
<string name="omemo_fingerprint_selected_message">OMEMO fingerprint of message</string> <string name="omemo_fingerprint_selected_message">OMEMO fingerprint of message</string>