aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-12-30 13:17:45 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-12-30 13:17:45 +0100
commit8c34bb3c6fb2be87eb9103bb2b647e2c7c80bfbc (patch)
tree72185861a27aaa3186e3e104c976c0889b7132bd /src/main/java/eu
parent40a9f70478473e7068185ba03b9acbbadb936525 (diff)
hide inactive devices by default in contact details
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index ea3816f7..69936b1d 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -38,6 +38,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
+import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -112,11 +113,13 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
private CheckBox send;
private CheckBox receive;
private Button addContactButton;
+ private Button mShowInactiveDevicesButton;
private QuickContactBadge badge;
private LinearLayout keys;
private FlowLayout tags;
private boolean showDynamicTags = false;
private boolean showLastSeen = false;
+ private boolean showInactiveOmemo = false;
private String messageFingerprint;
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
@@ -188,6 +191,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ showInactiveOmemo = savedInstanceState != null && savedInstanceState.getBoolean("show_inactive_omemo",false);
if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
try {
this.accountJid = Jid.fromString(getIntent().getExtras().getString(EXTRA_ACCOUNT));
@@ -217,10 +221,24 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
});
keys = (LinearLayout) findViewById(R.id.details_contact_keys);
tags = (FlowLayout) findViewById(R.id.tags);
+ mShowInactiveDevicesButton = (Button) findViewById(R.id.show_inactive_devices);
if (getActionBar() != null) {
getActionBar().setHomeButtonEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
}
+ mShowInactiveDevicesButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showInactiveOmemo = !showInactiveOmemo;
+ populateView();
+ }
+ });
+ }
+
+ @Override
+ public void onSaveInstanceState(final Bundle savedInstanceState) {
+ savedInstanceState.putBoolean("show_inactive_omemo",showInactiveOmemo);
+ super.onSaveInstanceState(savedInstanceState);
}
@Override
@@ -444,13 +462,32 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
}
if (Config.supportOmemo()) {
+ boolean skippedInactive = false;
+ boolean showsInactive = false;
for (final XmppAxolotlSession session : contact.getAccount().getAxolotlService().findSessionsForContact(contact)) {
- if (!session.getTrust().isCompromised()) {
+ final FingerprintStatus trust = session.getTrust();
+ if (!trust.isActive()) {
+ if (showInactiveOmemo) {
+ showsInactive = true;
+ } else {
+ skippedInactive = true;
+ continue;
+ }
+ }
+ if (!trust.isCompromised()) {
boolean highlight = session.getFingerprint().equals(messageFingerprint);
hasKeys = true;
addFingerprintRow(keys, session, highlight);
}
}
+ if (showsInactive || skippedInactive) {
+ mShowInactiveDevicesButton.setText(showsInactive ? R.string.hide_inactive_devices : R.string.show_inactive_devices);
+ mShowInactiveDevicesButton.setVisibility(View.VISIBLE);
+ } else {
+ mShowInactiveDevicesButton.setVisibility(View.GONE);
+ }
+ } else {
+ mShowInactiveDevicesButton.setVisibility(View.GONE);
}
if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) {
hasKeys = true;