diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-22 20:20:10 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-22 20:20:10 +0200 |
commit | bcc69353e16dac911de23505b1c37bea2d3bdb80 (patch) | |
tree | 35e1ea440502ed4138fd155e791b5e7ffb969456 /src/main/java/de/pixart/messenger/ui | |
parent | f44e12b077384c1f0fb14234f518e41fa73710a5 (diff) |
show account chooser for new conferences / join conferences
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
3 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/CreateConferenceDialog.java b/src/main/java/de/pixart/messenger/ui/CreateConferenceDialog.java index 0cb6e294f..da0fe37de 100644 --- a/src/main/java/de/pixart/messenger/ui/CreateConferenceDialog.java +++ b/src/main/java/de/pixart/messenger/ui/CreateConferenceDialog.java @@ -21,13 +21,15 @@ import de.pixart.messenger.services.XmppConnectionService; public class CreateConferenceDialog extends DialogFragment { private static final String ACCOUNTS_LIST_KEY = "activated_accounts_list"; + private static final String MULTIPLE_ACCOUNTS = "multiple_accounts_enabled"; public XmppConnectionService xmppConnectionService; private CreateConferenceDialogListener mListener; - public static CreateConferenceDialog newInstance(List<String> accounts) { + public static CreateConferenceDialog newInstance(List<String> accounts, boolean multipleAccounts) { CreateConferenceDialog dialog = new CreateConferenceDialog(); Bundle bundle = new Bundle(); bundle.putStringArrayList(ACCOUNTS_LIST_KEY, (ArrayList<String>) accounts); + bundle.putBoolean(MULTIPLE_ACCOUNTS, multipleAccounts); dialog.setArguments(bundle); return dialog; } @@ -48,7 +50,7 @@ public class CreateConferenceDialog extends DialogFragment { //final Spinner spinner = dialogView.findViewById(R.id.account); //final EditText subject = dialogView.findViewById(R.id.subject); CreateConferenceDialogBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.create_conference_dialog, null, false); - if (xmppConnectionService != null && xmppConnectionService.multipleAccounts()) { + if (getArguments().getBoolean(MULTIPLE_ACCOUNTS)) { binding.yourAccount.setVisibility(View.VISIBLE); binding.account.setVisibility(View.VISIBLE); } else { diff --git a/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java b/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java index 21b6ff743..c35a95438 100644 --- a/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java +++ b/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java @@ -28,15 +28,18 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon private static final String PREFILLED_JID_KEY = "prefilled_jid"; private static final String ACCOUNTS_LIST_KEY = "activated_accounts_list"; + private static final String MULTIPLE_ACCOUNTS = "multiple_accounts_enabled"; public XmppConnectionService xmppConnectionService; private JoinConferenceDialogListener mListener; private KnownHostsAdapter knownHostsAdapter; - public static JoinConferenceDialog newInstance(String prefilledJid, List<String> accounts) { + public static JoinConferenceDialog newInstance(String prefilledJid, List<String> accounts, boolean multipleAccounts) { JoinConferenceDialog dialog = new JoinConferenceDialog(); Bundle bundle = new Bundle(); bundle.putString(PREFILLED_JID_KEY, prefilledJid); + bundle.putBoolean(MULTIPLE_ACCOUNTS, multipleAccounts); bundle.putStringArrayList(ACCOUNTS_LIST_KEY, (ArrayList<String>) accounts); + dialog.setArguments(bundle); return dialog; } @@ -60,7 +63,7 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon if (prefilledJid != null) { binding.jid.append(prefilledJid); } - if (xmppConnectionService != null && xmppConnectionService.multipleAccounts()) { + if (getArguments().getBoolean(MULTIPLE_ACCOUNTS)) { binding.yourAccount.setVisibility(View.VISIBLE); binding.account.setVisibility(View.VISIBLE); } else { diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index a46c2a6c3..85ae80f84 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -494,7 +494,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU ft.remove(prev); } ft.addToBackStack(null); - JoinConferenceDialog joinConferenceFragment = JoinConferenceDialog.newInstance(prefilledJid, mActivatedAccounts); + JoinConferenceDialog joinConferenceFragment = JoinConferenceDialog.newInstance(prefilledJid, mActivatedAccounts, xmppConnectionService.multipleAccounts()); joinConferenceFragment.show(ft, FRAGMENT_TAG_DIALOG); } @@ -505,7 +505,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU ft.remove(prev); } ft.addToBackStack(null); - CreateConferenceDialog createConferenceFragment = CreateConferenceDialog.newInstance(mActivatedAccounts); + CreateConferenceDialog createConferenceFragment = CreateConferenceDialog.newInstance(mActivatedAccounts, xmppConnectionService.multipleAccounts()); createConferenceFragment.show(ft, FRAGMENT_TAG_DIALOG); } |