From 1a89915b31162437d61f167959e3db55459c4f5a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 3 Dec 2016 23:49:00 +0100 Subject: [PATCH] disable 'show blocklist' if blocklist is empty. fixes #2164 --- .../eu/siacs/conversations/ui/EditAccountActivity.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 4c576771a..e1035db6d 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -56,6 +56,7 @@ import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection.Features; import eu.siacs.conversations.xmpp.forms.Data; @@ -63,7 +64,7 @@ import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.pep.Avatar; -public class EditAccountActivity extends OmemoActivity implements OnAccountUpdate, +public class EditAccountActivity extends OmemoActivity implements OnAccountUpdate, OnUpdateBlocklist, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { private static final int REQUEST_DATA_SAVER = 0x37af244; @@ -573,6 +574,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (mAccount != null && mAccount.isOnlineAndConnected()) { if (!mAccount.getXmppConnection().getFeatures().blocking()) { showBlocklist.setVisible(false); + } else { + showBlocklist.setEnabled(mAccount.getBlocklist().size() > 0); } if (!mAccount.getXmppConnection().getFeatures().register()) { changePassword.setVisible(false); @@ -1199,4 +1202,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } }); } + + @Override + public void OnUpdateBlocklist(Status status) { + refreshUi(); + } }