disable 'show blocklist' if blocklist is empty. fixes #2164

This commit is contained in:
Daniel Gultsch 2016-12-03 23:49:00 +01:00
parent a5b3c579c4
commit 1a89915b31

View File

@ -56,6 +56,7 @@ import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.XmppConnection.Features; import eu.siacs.conversations.xmpp.XmppConnection.Features;
import eu.siacs.conversations.xmpp.forms.Data; 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.jid.Jid;
import eu.siacs.conversations.xmpp.pep.Avatar; 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 { OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched {
private static final int REQUEST_DATA_SAVER = 0x37af244; 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 != null && mAccount.isOnlineAndConnected()) {
if (!mAccount.getXmppConnection().getFeatures().blocking()) { if (!mAccount.getXmppConnection().getFeatures().blocking()) {
showBlocklist.setVisible(false); showBlocklist.setVisible(false);
} else {
showBlocklist.setEnabled(mAccount.getBlocklist().size() > 0);
} }
if (!mAccount.getXmppConnection().getFeatures().register()) { if (!mAccount.getXmppConnection().getFeatures().register()) {
changePassword.setVisible(false); changePassword.setVisible(false);
@ -1199,4 +1202,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
}); });
} }
@Override
public void OnUpdateBlocklist(Status status) {
refreshUi();
}
} }