diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index ac6d627a2..74f4d5379 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -57,6 +57,7 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.MucDetailsContextMenuHelper;
import eu.siacs.conversations.ui.util.MyLinkify;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
+import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.EmojiWrapper;
import eu.siacs.conversations.utils.StringUtils;
@@ -419,6 +420,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.muc_details, menu);
+ AccountUtils.showHideMenuItems(menu);
return super.onCreateOptionsMenu(menu);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index d405059ef..cc1c0a16f 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -46,6 +46,7 @@ import eu.siacs.conversations.ui.util.Attachment;
import eu.siacs.conversations.ui.util.GridManager;
import eu.siacs.conversations.ui.util.JidDialog;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
+import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.IrregularUnicodeDetector;
import eu.siacs.conversations.utils.UIHelper;
@@ -280,6 +281,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.contact_details, menu);
+ AccountUtils.showHideMenuItems(menu);
MenuItem block = menu.findItem(R.id.action_block);
MenuItem unblock = menu.findItem(R.id.action_unblock);
MenuItem edit = menu.findItem(R.id.action_edit_contact);
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
index e4fa49073..b79b1360d 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
@@ -76,6 +76,7 @@ import eu.siacs.conversations.ui.util.ActivityResult;
import eu.siacs.conversations.ui.util.ConversationMenuConfigurator;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem;
+import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.EmojiWrapper;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.SignupUtils;
@@ -377,6 +378,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_conversations, menu);
+ AccountUtils.showHideMenuItems(menu);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
if (qrCodeScanMenuItem != null) {
if (isCameraFeatureAvailable()) {
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index b6ef8f842..07b3dfbdc 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -75,6 +75,7 @@ import eu.siacs.conversations.ui.util.JidDialog;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
+import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.XmppConnection;
@@ -580,6 +581,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.start_conversation, menu);
+ AccountUtils.showHideMenuItems(menu);
MenuItem menuHideOffline = menu.findItem(R.id.action_hide_offline);
MenuItem joinGroupChat = menu.findItem(R.id.action_join_conference);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index fc590e878..fc60000dc 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -46,7 +46,6 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
@@ -55,7 +54,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.atomic.AtomicBoolean;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -341,6 +339,9 @@ public abstract class XmppActivity extends ActionBarActivity {
case R.id.action_accounts:
AccountUtils.launchManageAccounts(this);
break;
+ case R.id.action_account:
+ AccountUtils.launchManageAccount(this);
+ break;
case android.R.id.home:
finish();
break;
diff --git a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java
index 5c2d1ce1d..1d4f4aacb 100644
--- a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java
+++ b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java
@@ -2,6 +2,8 @@ package eu.siacs.conversations.utils;
import android.app.Activity;
import android.content.Intent;
+import android.view.Menu;
+import android.view.MenuItem;
import android.widget.Toast;
import java.util.List;
@@ -9,6 +11,7 @@ import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
+import eu.siacs.conversations.ui.XmppActivity;
public class AccountUtils {
@@ -49,6 +52,11 @@ public class AccountUtils {
}
}
+ public static void launchManageAccount(XmppActivity xmppActivity) {
+ Account account = getFirstEnabled(xmppActivity.xmppConnectionService);
+ xmppActivity.switchToAccount(account);
+ }
+
private static Class getManageAccountActivityClass() {
try {
return Class.forName("eu.siacs.conversations.ui.ManageAccountActivity");
@@ -56,4 +64,11 @@ public class AccountUtils {
return null;
}
}
+
+ public static void showHideMenuItems(final Menu menu) {
+ final MenuItem manageAccounts = menu.findItem(R.id.action_accounts);
+ final MenuItem manageAccount = menu.findItem(R.id.action_account);
+ manageAccount.setVisible(MANAGE_ACCOUNT_ACTIVITY == null);
+ manageAccounts.setVisible(MANAGE_ACCOUNT_ACTIVITY != null);
+ }
}
diff --git a/src/main/res/menu/activity_conversations.xml b/src/main/res/menu/activity_conversations.xml
index 2a0ce4b33..3275fdc6d 100644
--- a/src/main/res/menu/activity_conversations.xml
+++ b/src/main/res/menu/activity_conversations.xml
@@ -12,6 +12,11 @@
android:orderInCategory="90"
android:title="@string/action_accounts"
app:showAsAction="never"/>
+
+
+
+
- Settings
New conversation
Manage accounts
+ Manage account
End this conversation
Contact details
Group chat details