M src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java => src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +2 -0
@@ 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);
}
M src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java => src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +2 -0
@@ 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);
M src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java => src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +2 -0
@@ 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()) {
M src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java => src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +2 -0
@@ 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);
M src/main/java/eu/siacs/conversations/ui/XmppActivity.java => src/main/java/eu/siacs/conversations/ui/XmppActivity.java +3 -2
@@ 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;
M src/main/java/eu/siacs/conversations/utils/AccountUtils.java => src/main/java/eu/siacs/conversations/utils/AccountUtils.java +15 -0
@@ 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);
+ }
}
M src/main/res/menu/activity_conversations.xml => src/main/res/menu/activity_conversations.xml +5 -0
@@ 13,6 13,11 @@
android:title="@string/action_accounts"
app:showAsAction="never"/>
<item
+ android:id="@+id/action_account"
+ android:orderInCategory="90"
+ android:title="@string/action_account"
+ app:showAsAction="never"/>
+ <item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
M src/main/res/menu/contact_details.xml => src/main/res/menu/contact_details.xml +5 -0
@@ 51,6 51,11 @@
app:showAsAction="never"
android:title="@string/action_accounts"/>
<item
+ android:id="@+id/action_account"
+ android:orderInCategory="90"
+ android:title="@string/action_account"
+ app:showAsAction="never"/>
+ <item
android:id="@+id/action_settings"
android:orderInCategory="100"
app:showAsAction="never"
M src/main/res/menu/muc_details.xml => src/main/res/menu/muc_details.xml +5 -0
@@ 44,6 44,11 @@
app:showAsAction="never"
android:title="@string/action_accounts"/>
<item
+ android:id="@+id/action_account"
+ android:orderInCategory="90"
+ android:title="@string/action_account"
+ app:showAsAction="never"/>
+ <item
android:id="@+id/action_settings"
android:orderInCategory="100"
app:showAsAction="never"
M src/main/res/menu/start_conversation.xml => src/main/res/menu/start_conversation.xml +5 -0
@@ 31,6 31,11 @@
android:title="@string/action_accounts"
app:showAsAction="never"/>
<item
+ android:id="@+id/action_account"
+ android:orderInCategory="90"
+ android:title="@string/action_account"
+ app:showAsAction="never"/>
+ <item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
M src/main/res/values/strings.xml => src/main/res/values/strings.xml +1 -0
@@ 3,6 3,7 @@
<string name="action_settings">Settings</string>
<string name="action_add">New conversation</string>
<string name="action_accounts">Manage accounts</string>
+ <string name="action_account">Manage account</string>
<string name="action_end_conversation">End this conversation</string>
<string name="action_contact_details">Contact details</string>
<string name="action_muc_details">Group chat details</string>