コード例 #1
0
  public static void MostrarAlertDialog(Context context, String mensaje, int tipoIcono) {

    AlertDialog alertDialog;

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder
        .setCancelable(false)
        .setPositiveButton(
            "Aceptar",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int id) {

                dialog.cancel();
              }
            });

    alertDialog = builder.create();
    alertDialog.setMessage(mensaje);

    if (tipoIcono == 1) {

      alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
      alertDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
      alertDialog.setTitle("Atencion");
      alertDialog.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
    }

    if (tipoIcono == 2) {

      alertDialog.setIcon(android.R.drawable.ic_dialog_info);
      alertDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
      alertDialog.setTitle("Mensaje");
      alertDialog.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_info);
    }

    alertDialog.show();
  }
コード例 #2
0
  private void showContactInviteDialog(final Contact contact) {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext());
    View view =
        getActivity()
            .getLayoutInflater()
            .inflate(R.layout.dialog_invite_contact, (ViewGroup) getView().getRootView(), false);

    View rootView = view.findViewById(R.id.dialog_root_view);

    TextView dialogTitle = (TextView) view.findViewById(R.id.dialog_title);
    dialogTitle.setTypeface(TypefaceUtil.PROXIMA_NOVA_BOLD);

    dialogMessage = (EditText) view.findViewById(R.id.contact_invite_message);
    dialogMessage.setTypeface(TypefaceUtil.PROXIMA_NOVA);

    TextView dialogCancel = (TextView) view.findViewById(R.id.invite_cancel);
    dialogCancel.setTypeface(TypefaceUtil.PROXIMA_NOVA_BOLD);
    TextView dialogSend = (TextView) view.findViewById(R.id.invite_send);
    dialogSend.setTypeface(TypefaceUtil.PROXIMA_NOVA_BOLD);

    dialogBuilder.setView(view);

    dialog = dialogBuilder.create();
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    dialogCancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });

    dialogSend.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            sendSMSMessage(contact);
          }
        });

    dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;

    dialog.show();
    dialog.getWindow().setLayout(1000, 1000);
  }
コード例 #3
0
ファイル: ContextDialog.java プロジェクト: k2wanko/NLiveRoid
 public void showSelf() {
   dialog = this.create();
   dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   dialog.getWindow().setLayout(-1, -1);
   dialog.show();
 }