From cd1fbf60ec920bbdb179c437a06db66a4de19483 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 23 Apr 2016 12:33:56 +0200 Subject: add change prescence to manage account context menu --- .../java/eu/siacs/conversations/ui/EditAccountActivity.java | 5 ++--- .../java/eu/siacs/conversations/ui/ManageAccountActivity.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 04824193..d4b0172d 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -477,9 +477,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate final MenuItem renewCertificate = menu.findItem(R.id.action_renew_certificate); final MenuItem mamPrefs = menu.findItem(R.id.action_mam_prefs); final MenuItem changePresence = menu.findItem(R.id.action_change_presence); - - changePresence.setVisible(manuallyChangePresence()); - renewCertificate.setVisible(mAccount != null && mAccount.getPrivateKeyAlias() != null); if (mAccount != null && mAccount.isOnlineAndConnected()) { @@ -494,6 +491,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate if (otherDevices == null || otherDevices.isEmpty()) { clearDevices.setVisible(false); } + changePresence.setVisible(manuallyChangePresence()); } else { showQrCode.setVisible(false); showBlocklist.setVisible(false); @@ -501,6 +499,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate changePassword.setVisible(false); clearDevices.setVisible(false); mamPrefs.setVisible(false); + changePresence.setVisible(false); } return super.onCreateOptionsMenu(menu); } diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index feac2c62..e43db5d3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -121,9 +121,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda menu.findItem(R.id.mgmt_account_disable).setVisible(false); menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(false); menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false); + menu.findItem(R.id.mgmt_account_change_presence).setVisible(false); } else { menu.findItem(R.id.mgmt_account_enable).setVisible(false); menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(Config.supportOpenPgp()); + menu.findItem(R.id.mgmt_account_change_presence).setVisible(manuallyChangePresence()); } menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString()); } @@ -187,6 +189,9 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda case R.id.mgmt_account_announce_pgp: publishOpenPGPPublicKey(selectedAccount); return true; + case R.id.mgmt_account_change_presence: + changePresence(selectedAccount); + return true; default: return super.onContextItemSelected(item); } @@ -235,6 +240,12 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda } } + private void changePresence(Account account) { + Intent intent = new Intent(this, SetPresenceActivity.class); + intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT,account.getJid().toBareJid().toString()); + startActivity(intent); + } + public void onClickTglAccountState(Account account, boolean enable) { if (enable) { enableAccount(account); -- cgit v1.2.3