Highlight selected message's fingerprint in list
This commit is contained in:
parent
e07853ea62
commit
2b3bb02261
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
android:textColor="@color/black54"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/key"
|
||||
android:maxLines="1"
|
||||
android:textSize="?attr/TextSizeInfo"/>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -209,6 +209,7 @@
|
|||
<string name="your_fingerprint">Your fingerprint</string>
|
||||
<string name="otr_fingerprint">OTR fingerprint</string>
|
||||
<string name="axolotl_fingerprint">Axolotl fingerprint</string>
|
||||
<string name="axolotl_fingerprint_selected_message">Axolotl fingerprint of message</string>
|
||||
<string name="this_device_axolotl_fingerprint">Own Axolotl fingerprint</string>
|
||||
<string name="other_devices">Other devices</string>
|
||||
<string name="trust_keys">Trust Axolotl Keys</string>
|
||||
|
|
Loading…
Reference in a new issue