Search in sources :

Example 1 with DialogJoinConferenceBinding

use of eu.siacs.conversations.databinding.DialogJoinConferenceBinding in project Conversations by siacs.

the class JoinConferenceDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.join_public_channel);
    DialogJoinConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_join_conference, null, false);
    DelayedHintHelper.setHint(R.string.channel_full_jid_example, binding.jid);
    this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item);
    binding.jid.setAdapter(knownHostsAdapter);
    String prefilledJid = getArguments().getString(PREFILLED_JID_KEY);
    if (prefilledJid != null) {
        binding.jid.append(prefilledJid);
    }
    StartConversationActivity.populateAccountSpinner(getActivity(), getArguments().getStringArrayList(ACCOUNTS_LIST_KEY), binding.account);
    builder.setView(binding.getRoot());
    builder.setPositiveButton(R.string.join, null);
    builder.setNegativeButton(R.string.cancel, null);
    AlertDialog dialog = builder.create();
    dialog.show();
    dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(view -> mListener.onJoinDialogPositiveClick(dialog, binding.account, binding.accountJidLayout, binding.jid, binding.bookmark.isChecked()));
    binding.jid.setOnEditorActionListener((v, actionId, event) -> {
        mListener.onJoinDialogPositiveClick(dialog, binding.account, binding.accountJidLayout, binding.jid, binding.bookmark.isChecked());
        return true;
    });
    return dialog;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) KnownHostsAdapter(eu.siacs.conversations.ui.adapter.KnownHostsAdapter) DialogJoinConferenceBinding(eu.siacs.conversations.databinding.DialogJoinConferenceBinding) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 DialogJoinConferenceBinding (eu.siacs.conversations.databinding.DialogJoinConferenceBinding)1 KnownHostsAdapter (eu.siacs.conversations.ui.adapter.KnownHostsAdapter)1