diff --git a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java index d19c73b5fd..89aa6f6d8a 100644 --- a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java @@ -47,6 +47,17 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon return dialog; } + public static JoinConferenceDialog newInstance(String prefilledJid, List 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) accounts); + + dialog.setArguments(bundle); + return dialog; + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 21a6bc70dd..3da3219e5c 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -387,7 +387,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne showPublicChannelDialog(); break; case R.id.join_public_channel: - showJoinConferenceDialog(prefilled, null); + showJoinConferenceDialog(prefilled); break; case R.id.create_contact: showCreateContactDialog(prefilled, null); @@ -712,6 +712,18 @@ public class StartConversationActivity extends XmppActivity implements XmppConne joinConferenceFragment.show(ft, FRAGMENT_TAG_DIALOG); } + @SuppressLint("InflateParams") + protected void showJoinConferenceDialog(final String prefilledJid) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + Fragment prev = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DIALOG); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + JoinConferenceDialog joinConferenceFragment = JoinConferenceDialog.newInstance(prefilledJid, mActivatedAccounts, xmppConnectionService.multipleAccounts()); + joinConferenceFragment.show(ft, FRAGMENT_TAG_DIALOG); + } + private void showCreatePrivateGroupChatDialog() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DIALOG);