aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java28
5 files changed, 32 insertions, 13 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index a0e02c1b..4c3923bb 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -110,6 +110,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
private LinearLayout keys;
private LinearLayout tags;
private boolean showDynamicTags;
+ private String messageFingerprint;
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
@@ -192,6 +193,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
} catch (final InvalidJidException ignored) {
}
}
+ this.messageFingerprint = getIntent().getStringExtra("fingerprint");
setContentView(R.layout.activity_contact_details);
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
@@ -385,7 +387,8 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
}
for(final IdentityKey identityKey : xmppConnectionService.databaseBackend.loadIdentityKeys(
contact.getAccount(), contact.getJid().toBareJid().toString())) {
- hasKeys |= addFingerprintRow(keys, contact.getAccount(), identityKey);
+ boolean highlight = identityKey.getFingerprint().replaceAll("\\s", "").equals(messageFingerprint);
+ hasKeys |= addFingerprintRow(keys, contact.getAccount(), identityKey, highlight);
}
if (contact.getPgpKeyId() != 0) {
hasKeys = true;
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 04429421..47c6a764 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -392,12 +392,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
highlightInConference(user);
}
} else {
- activity.switchToContactDetails(message.getContact());
+ activity.switchToContactDetails(message.getContact(), message.getAxolotlFingerprint());
}
} else {
Account account = message.getConversation().getAccount();
Intent intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toBareJid().toString());
+ intent.putExtra("fingerprint", message.getAxolotlFingerprint());
startActivity(intent);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 3c1f155d..a1c28df8 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -74,6 +74,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
private Jid jidToEdit;
private Account mAccount;
+ private String messageFingerprint;
private boolean mFetchingAvatar = false;
@@ -388,6 +389,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
} catch (final InvalidJidException | NullPointerException ignored) {
this.jidToEdit = null;
}
+ this.messageFingerprint = getIntent().getStringExtra("fingerprint");
if (this.jidToEdit != null) {
this.mRegisterNew.setVisibility(View.GONE);
if (getActionBar() != null) {
@@ -571,7 +573,8 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
if(ownKey.equals(identityKey)) {
continue;
}
- hasKeys |= addFingerprintRow(keys, mAccount, identityKey);
+ boolean highlight = identityKey.getFingerprint().replaceAll("\\s", "").equals(messageFingerprint);
+ hasKeys |= addFingerprintRow(keys, mAccount, identityKey, highlight);
}
if (hasKeys) {
keysCard.setVisibility(View.VISIBLE);
diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
index 0b5d092b..d5959b7a 100644
--- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
@@ -118,7 +118,7 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
boolean hasForeignKeys = false;
for(final IdentityKey identityKey : ownKeysToTrust.keySet()) {
hasOwnKeys = true;
- addFingerprintRowWithListeners(ownKeys, contact.getAccount(), identityKey,
+ addFingerprintRowWithListeners(ownKeys, contact.getAccount(), identityKey, false,
Trust.fromBoolean(ownKeysToTrust.get(identityKey)), false,
new CompoundButton.OnCheckedChangeListener() {
@Override
@@ -134,7 +134,7 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
}
for(final IdentityKey identityKey : foreignKeysToTrust.keySet()) {
hasForeignKeys = true;
- addFingerprintRowWithListeners(foreignKeys, contact.getAccount(), identityKey,
+ addFingerprintRowWithListeners(foreignKeys, contact.getAccount(), identityKey, false,
Trust.fromBoolean(foreignKeysToTrust.get(identityKey)), false,
new CompoundButton.OnCheckedChangeListener() {
@Override
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 857a1dc4..3093db46 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -424,10 +424,15 @@ public abstract class XmppActivity extends Activity {
}
public void switchToContactDetails(Contact contact) {
+ switchToContactDetails(contact, null);
+ }
+
+ public void switchToContactDetails(Contact contact, String messageFingerprint) {
Intent intent = new Intent(this, ContactDetailsActivity.class);
intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
intent.putExtra("account", contact.getAccount().getJid().toBareJid().toString());
intent.putExtra("contact", contact.getJid().toString());
+ intent.putExtra("fingerprint", messageFingerprint);
startActivity(intent);
}
@@ -608,11 +613,11 @@ public abstract class XmppActivity extends Activity {
builder.create().show();
}
- protected boolean addFingerprintRow(LinearLayout keys, final Account account, IdentityKey identityKey) {
+ protected boolean addFingerprintRow(LinearLayout keys, final Account account, IdentityKey identityKey, boolean highlight) {
final String fingerprint = identityKey.getFingerprint().replaceAll("\\s", "");
final SQLiteAxolotlStore.Trust trust = account.getAxolotlService()
.getFingerprintTrust(fingerprint);
- return addFingerprintRowWithListeners(keys, account, identityKey, trust, true,
+ return addFingerprintRowWithListeners(keys, account, identityKey, highlight, trust, true,
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -636,12 +641,13 @@ public abstract class XmppActivity extends Activity {
}
protected boolean addFingerprintRowWithListeners(LinearLayout keys, final Account account,
- final IdentityKey identityKey,
- SQLiteAxolotlStore.Trust trust,
- boolean showTag,
- CompoundButton.OnCheckedChangeListener
- onCheckedChangeListener,
- View.OnClickListener onClickListener) {
+ final IdentityKey identityKey,
+ boolean highlight,
+ SQLiteAxolotlStore.Trust trust,
+ boolean showTag,
+ CompoundButton.OnCheckedChangeListener
+ onCheckedChangeListener,
+ View.OnClickListener onClickListener) {
if (trust == SQLiteAxolotlStore.Trust.COMPROMISED) {
return false;
}
@@ -688,6 +694,12 @@ public abstract class XmppActivity extends Activity {
} else {
keyType.setVisibility(View.GONE);
}
+ if (highlight) {
+ keyType.setTextColor(getResources().getColor(R.color.accent));
+ keyType.setText(getString(R.string.axolotl_fingerprint_selected_message));
+ } else {
+ keyType.setText(getString(R.string.axolotl_fingerprint));
+ }
key.setText(CryptoHelper.prettifyFingerprint(identityKey.getFingerprint()));
keys.addView(view);