From cd1fbf60ec920bbdb179c437a06db66a4de19483 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 23 Apr 2016 12:33:56 +0200 Subject: [PATCH] add change prescence to manage account context menu --- .../siacs/conversations/ui/EditAccountActivity.java | 5 ++--- .../siacs/conversations/ui/ManageAccountActivity.java | 11 +++++++++++ src/main/res/menu/manageaccounts_context.xml | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 04824193b..d4b0172db 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 feac2c622..e43db5d3e 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); diff --git a/src/main/res/menu/manageaccounts_context.xml b/src/main/res/menu/manageaccounts_context.xml index 7a7cc0a22..d8b0093e6 100644 --- a/src/main/res/menu/manageaccounts_context.xml +++ b/src/main/res/menu/manageaccounts_context.xml @@ -4,6 +4,9 @@ +