Exemplo n.º 1
0
  public static void showFailCheck(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.success_dialog);

    ImageView iv = (ImageView) dialog.findViewById(R.id.image);
    iv.setImageDrawable(context.getResources().getDrawable(R.drawable.fail));

    LinearLayout dialogButton = (LinearLayout) dialog.findViewById(R.id.okbtn);
    TextView tv = (TextView) dialog.findViewById(R.id.dialogText);
    tv.setText(Globals.getTranslation("OK"));

    TextView title = (TextView) dialog.findViewById(R.id.title);
    TextView msg = (TextView) dialog.findViewById(R.id.msg);

    title.setText(Globals.getTranslation("FAIL"));
    msg.setText(Globals.getTranslation("ERROR_MESSAGE"));

    // if button is clicked, close the custom dialog
    dialogButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d("FAIL OK", "OK");
            dialog.hide();
            dialog.dismiss();
            // dialog = null;
          }
        });

    dialog.show();
  }
Exemplo n.º 2
0
  public static void showSuccess(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.success_dialog);

    TextView title = (TextView) dialog.findViewById(R.id.title);
    TextView msg = (TextView) dialog.findViewById(R.id.msg);

    title.setText(Globals.getTranslation("SUCCESS"));
    msg.setText(Globals.getTranslation("SUCCESS_MESSAGE"));

    TextView tv = (TextView) dialog.findViewById(R.id.dialogText);
    tv.setText(Globals.getTranslation("OK"));

    LinearLayout dialogButton = (LinearLayout) dialog.findViewById(R.id.okbtn);
    // if button is clicked, close the custom dialog
    dialogButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d("SUCCESS OK", "OK");
            dialog.hide();
            dialog.dismiss();
            // dialog = null;
          }
        });

    dialog.show();
  }