Example #1
0
  @NonNull
  @Override
  @SuppressLint("InflateParams")
  public AppCompatDialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_sharelink, null, false);
    ButterKnife.bind(this, view);

    // build dialog
    AlertDialog dialog =
        new AlertDialog.Builder(getActivity(), R.style.Widget_Proxy_App_Dialog)
            .setTitle(getString(R.string.dialog_sharelink_title))
            .setView(view)
            .setPositiveButton(getString(R.string.share), _positiveClicked)
            .setNegativeButton(android.R.string.cancel, _negativeClicked)
            .create();

    message.setText(getString(R.string.dialog_sharelink_message));
    // Show the SW Keyboard on dialog start. Always.
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    dialog.getWindow().getAttributes().width = WindowManager.LayoutParams.MATCH_PARENT;
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
  }