From d55a3842d36db67da02b2947fc98cfc80bf20083 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 19 Feb 2018 18:17:43 +0100 Subject: [PATCH] more otr cleanup --- .../ui/ContactDetailsActivity.java | 32 +------------------ .../ui/ConversationActivity.java | 3 +- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 6c74e4620..4573fa097 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.ui; import android.databinding.DataBindingUtil; import android.support.v7.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; @@ -20,11 +19,9 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; -import com.wefika.flowlayout.FlowLayout; import org.openintents.openpgp.util.OpenPgpUtils; @@ -41,7 +38,6 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; -import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xml.Namespace; @@ -449,13 +445,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp keyType.setTextColor(ContextCompat.getColor(this, R.color.accent)); } key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId())); - final OnClickListener openKey = new OnClickListener() { - - @Override - public void onClick(View v) { - launchOpenKeyChain(contact.getPgpKeyId()); - } - }; + final OnClickListener openKey = v -> launchOpenKeyChain(contact.getPgpKeyId()); view.setOnClickListener(openKey); key.setOnClickListener(openKey); keyType.setOnClickListener(openKey); @@ -478,26 +468,6 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } } - protected void confirmToDeleteFingerprint(final String fingerprint) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.delete_fingerprint); - builder.setMessage(R.string.sure_delete_fingerprint); - builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.delete, - new android.content.DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - if (contact.deleteOtrFingerprint(fingerprint)) { - populateView(); - xmppConnectionService.syncRosterToDisk(contact.getAccount()); - } - } - - }); - builder.create().show(); - } - public void onBackendConnected() { if (accountJid != null && contactJid != null) { Account account = xmppConnectionService.findAccountByJid(accountJid); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index e1b6c6f5e..2af68029c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -456,7 +456,8 @@ public class ConversationActivity extends XmppActivity pgp.setVisible(Config.supportOpenPgp()); none.setVisible(Config.supportUnencrypted() || conversation.getMode() == Conversation.MODE_MULTI); axolotl.setVisible(Config.supportOmemo()); - if (!conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) { + final AxolotlService axolotlService = conversation.getAccount().getAxolotlService(); + if (axolotlService == null || !axolotlService.isConversationAxolotlCapable(conversation)) { axolotl.setEnabled(false); } switch (conversation.getNextEncryption()) {