aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-19 14:09:49 +0200
committerAndreas Straub <andy@strb.org>2015-07-19 22:24:03 +0200
commit6f67469bda0ffe97cb8cd8d400affed5a17c34c5 (patch)
tree613d1076eff9802f4cdb47b8998db69ec688cb14 /src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
parent9c4d55f82ce50391ac09b4f7d7a0f3576c014e56 (diff)
Refactor trust key ui and show in account details
Refactored the trust key row UI element so it can be used in multiple places. It now also uses a slider to toggle the trust state, and the redundant trust state description was removed. EditAccountActivity now shows the keys of other devices associated with that account.
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java49
1 files changed, 1 insertions, 48 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index ef99b4915..e7a8ffb75 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -35,7 +35,6 @@ import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
-import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.ListItem;
@@ -381,53 +380,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
for(final IdentityKey identityKey : xmppConnectionService.databaseBackend.loadIdentityKeys(
contact.getAccount(), contact.getJid().toBareJid().toString())) {
hasKeys = true;
- View view = inflater.inflate(R.layout.contact_key, keys, false);
- TextView key = (TextView) view.findViewById(R.id.key);
- TextView keyType = (TextView) view.findViewById(R.id.key_type);
- TextView keyTrust = (TextView) view.findViewById(R.id.key_trust);
- ImageButton removeButton = (ImageButton) view
- .findViewById(R.id.button_remove);
- ImageButton trustButton = (ImageButton) view
- .findViewById(R.id.button_trust);
- final AxolotlService axolotlService = contact.getAccount().getAxolotlService();
- final String fingerprint = identityKey.getFingerprint().replaceAll("\\s", "");
- final Jid bareJid = contactJid.toBareJid();
- AxolotlService.SQLiteAxolotlStore.Trust trust = contact.getAccount().getAxolotlService()
- .getFingerprintTrust(fingerprint);
- switch (trust) {
- case TRUSTED:
- removeButton.setVisibility(View.VISIBLE);
- //Log.d(Config.LOGTAG, AxolotlService.getLogprefix(contact.getAccount()) + "Setting remove button visible!");
- break;
- case UNDECIDED:
- case UNTRUSTED:
- //Log.d(Config.LOGTAG, AxolotlService.getLogprefix(contact.getAccount()) + "Setting trust button visible!");
- trustButton.setVisibility(View.VISIBLE);
- break;
- }
- keyType.setText("Axolotl Fingerprint");
- key.setText(CryptoHelper.prettifyFingerprint(identityKey.getFingerprint()));
- keyTrust.setText(trust.toString());
- keyTrust.setVisibility(View.VISIBLE);
- keys.addView(view);
- removeButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- axolotlService.setFingerprintTrust(fingerprint,
- AxolotlService.SQLiteAxolotlStore.Trust.UNTRUSTED);
- refreshUi();
- xmppConnectionService.updateConversationUi();
- }
- });
- trustButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- axolotlService.setFingerprintTrust(fingerprint,
- AxolotlService.SQLiteAxolotlStore.Trust.TRUSTED);
- refreshUi();
- xmppConnectionService.updateConversationUi();
- }
- });
+ addFingerprintRow(keys, contact.getAccount(), identityKey);
}
if (contact.getPgpKeyId() != 0) {
hasKeys = true;