Ejemplo n.º 1
1
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.Edit_Contact:
        Button b = (Button) findViewById(R.id.button1);
        b.setVisibility(View.VISIBLE);
        name.setEnabled(true);
        name.setFocusableInTouchMode(true);
        name.setClickable(true);

        phone.setEnabled(true);
        phone.setFocusableInTouchMode(true);
        phone.setClickable(true);

        email.setEnabled(true);
        email.setFocusableInTouchMode(true);
        email.setClickable(true);

        street.setEnabled(true);
        street.setFocusableInTouchMode(true);
        street.setClickable(true);

        place.setEnabled(true);
        place.setFocusableInTouchMode(true);
        place.setClickable(true);

        return true;
      case R.id.Delete_Contact:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setMessage(R.string.deleteContact)
            .setPositiveButton(
                R.string.yes,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    mydb.deleteContact(id_To_Update);
                    Toast.makeText(
                            getApplicationContext(), "Deleted Successfully", Toast.LENGTH_SHORT)
                        .show();
                    Intent intent =
                        new Intent(getApplicationContext(), com.example.myapp.MainActivity.class);
                    startActivity(intent);
                  }
                })
            .setNegativeButton(
                R.string.no,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    // User cancelled the dialog
                  }
                });
        AlertDialog d = builder.create();
        d.setTitle("Are you sure");
        d.show();

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Ejemplo n.º 2
0
  protected void pinCodeEnd(boolean state) {
    AlertDialog aDialog = new AlertDialog.Builder(this).create();

    if (state) {
      CharSequence saveSeq = getString(R.string.common_save_exit);
      aDialog.setTitle(saveSeq);
      CharSequence cseq = getString(R.string.pincode_stored);
      aDialog.setMessage(cseq);

    } else {
      CharSequence saveSeq = getString(R.string.common_save_exit);
      aDialog.setTitle(saveSeq);
      CharSequence cseq = getString(R.string.pincode_removed);
      aDialog.setMessage(cseq);
    }
    CharSequence okSeq = getString(R.string.common_ok);
    aDialog.setButton(
        okSeq,
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            finish();
            return;
          }
        });
    aDialog.show();
  }
Ejemplo n.º 3
0
  public void handleClick(View view) {
    Button button = (Button) view;
    if (!button.getText().toString().equals("")) {
      // Place taken
      return;
    }
    boolean isWinnerMove;
    try {
      isWinnerMove = game.moveMade(side, getPos(view.getId()));
    } catch (Exception e) {
      // Place taken
      return;
    }
    moveCounter++;

    String text = "";
    if (isX) {
      isX = false;
      side = Side.X;
      text = side.toString();
    } else {
      isX = true;
      side = Side.O;
      text = side.toString();
    }
    button.setText(text);

    // Now check Win
    if (isWinnerMove) {
      AlertDialog alertDialog = new AlertDialog.Builder(this).create();
      alertDialog.setTitle("We have a winner!");
      alertDialog.setMessage(side.toString() + " wins the game!");
      setDialogButtons(alertDialog);
      alertDialog.show();
      return;
    }

    // Switsh sides
    if (side == Side.X) {
      side = Side.O;
    } else {
      side = Side.X;
    }

    // Should'nt get here if there's a winner
    if (moveCounter == 9) {
      AlertDialog alertDialog = new AlertDialog.Builder(this).create();
      alertDialog.setTitle("We have a tie!");
      alertDialog.setMessage("You're both extremely good!");
      setDialogButtons(alertDialog);
      alertDialog.show();
      return;
    }
  }
Ejemplo n.º 4
0
 @Override
 @SuppressWarnings("deprecation")
 protected void onPrepareDialog(final int id, final Dialog dialog) {
   super.onPrepareDialog(id, dialog);
   switch (id) {
     case ModifyDeviceDialogBuilder.DIALOG_ID:
       ((AlertDialog) dialog).setTitle(getIntent().getStringExtra("deviceName"));
       break;
     case DeleteDeviceDialogBuilder.DIALOG_ID:
       ((AlertDialog) dialog).setTitle(getIntent().getStringExtra("deviceName"));
       break;
   }
 }
Ejemplo n.º 5
0
 @Override
 public void onClick(View v) {
   final SharedPreferences settings = MyApplication.getInstance().getSettings();
   final String securityQuestion = MyApplication.PrefKey.SECURITY_QUESTION.getString("");
   EditText input = (EditText) dialog.findViewById(R.id.password);
   TextView error = (TextView) dialog.findViewById(R.id.passwordInvalid);
   if (v == dialog.getButton(AlertDialog.BUTTON_NEGATIVE)) {
     if ((Boolean) input.getTag()) {
       input.setTag(Boolean.valueOf(false));
       ((Button) v).setText(R.string.password_lost);
       dialog.setTitle(R.string.password_prompt);
     } else {
       input.setTag(Boolean.valueOf(true));
       dialog.setTitle(securityQuestion);
       ((Button) v).setText(android.R.string.cancel);
     }
   } else {
     String value = input.getText().toString();
     boolean isInSecurityQuestion = (Boolean) input.getTag();
     if (Utils.md5(value)
         .equals(
             (isInSecurityQuestion
                     ? MyApplication.PrefKey.SECURITY_ANSWER
                     : MyApplication.PrefKey.SET_PASSWORD)
                 .getString(""))) {
       input.setText("");
       error.setText("");
       MyApplication.getInstance().setLocked(false);
       ctx.findViewById(android.R.id.content).setVisibility(View.VISIBLE);
       if (ctx instanceof ActionBarActivity) {
         ((ActionBarActivity) ctx).getSupportActionBar().show();
       }
       if (isInSecurityQuestion) {
         MyApplication.PrefKey.PERFORM_PROTECTION.putBoolean(false);
         Toast.makeText(
                 ctx.getBaseContext(), R.string.password_disabled_reenable, Toast.LENGTH_LONG)
             .show();
         dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setText(R.string.password_lost);
         dialog.setTitle(R.string.password_prompt);
         input.setTag(Boolean.valueOf(false));
       }
       dialog.dismiss();
     } else {
       input.setText("");
       error.setText(
           isInSecurityQuestion
               ? R.string.password_security_answer_not_valid
               : R.string.password_not_valid);
     }
   }
 }
Ejemplo n.º 6
0
  @Override
  protected Dialog onCreateDialog(int id) {
    switch (id) {
      case DIALOG_PROMPT:
        {
          AlertDialog dialog = (new AlertDialog.Builder(this)).create();
          dialog.setTitle("Ushahidi Setup");
          dialog.setMessage("Setup an ushahidi instance.");
          dialog.setButton2(
              "Ok",
              new Dialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                  Intent launchPreferencesIntent =
                      new Intent().setClass(Ushahidi.this, Settings.class);

                  // Make it a subactivity so we know when it returns
                  startActivityForResult(launchPreferencesIntent, REQUEST_CODE_SETTINGS);
                  dialog.dismiss();
                }
              });
          dialog.setCancelable(false);
          return dialog;
        }

      case DIALOG_ERROR:
        {
          AlertDialog dialog = (new AlertDialog.Builder(this)).create();
          dialog.setTitle(R.string.alert_dialog_error_title);
          dialog.setMessage(dialogErrorMsg);
          dialog.setButton2(
              "Ok",
              new Dialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {

                  Intent launchPreferencesIntent = new Intent(Ushahidi.this, Settings.class);

                  // Make it a subactivity so we know when it returns
                  startActivityForResult(launchPreferencesIntent, REQUEST_CODE_SETTINGS);

                  dialog.dismiss();
                }
              });
          dialog.setCancelable(false);
          return dialog;
        }
    }
    return null;
  }
Ejemplo n.º 7
0
  private void verifySuccess() {
    AlertDialog dialog = new AlertDialog.Builder(getActivity()).create();
    dialog.setTitle(getResources().getString(R.string.txt_verify_dialog_title));
    dialog.setMessage(getResources().getString(R.string.txt_verify_dialog_message));
    dialog.setCancelable(false);
    dialog.setButton(
        DialogInterface.BUTTON_POSITIVE,
        getResources().getString(R.string.txt_verify),
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent("com.google.zxing.client.android.SCAN");
            intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
            startActivityForResult(intent, 0);
          }
        });
    dialog.setButton(
        DialogInterface.BUTTON_NEGATIVE,
        getResources().getString(R.string.txt_cancel),
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    dialog.show();
  }
  private void verify() {
    AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
    alertDialog.setTitle("Error..!!");
    alertDialog.setMessage("Please fill all the details..!!");
    alertDialog.setButton(
        android.support.v7.app.AlertDialog.BUTTON_NEUTRAL,
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });

    if (Name.equals("")) {
      alertDialog.setMessage("Enter name..!!");
      alertDialog.show();
    } else if (Temp.equals("")) {
      alertDialog.setMessage("Enter temperature..!!");
      alertDialog.show();
    } else if (Bloodp.equals("")) {
      alertDialog.setMessage("Enter blood pressure..!!");
      alertDialog.show();
    } else if (Sugar.equals("")) {
      alertDialog.setMessage("Enter sugar level..!!");
      alertDialog.show();
    } else {
      verify_flag = true;
    }
  }
Ejemplo n.º 9
0
  private void popdialogue() {
    final AlertDialog builder = new AlertDialog.Builder(EditPage.this).create();

    LayoutInflater inflater = LayoutInflater.from(this);
    View selectView =
        inflater.inflate(R.layout.picture_dialog, (ViewGroup) findViewById(R.id.layout_root));
    gridView = (GridView) selectView.findViewById(R.id.gridview);

    PictureAdapter adapter =
        new PictureAdapter(ImageUtil.imageMoodTitles, ImageUtil.imageMoodFiles, this);
    gridView.setAdapter(adapter);
    gridView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            mMoodIndex = position;

            ImageButton mMoodButton = (ImageButton) findViewById(R.id.emotion_sticker);
            mMoodButton.setImageResource(ImageUtil.imageMoodFiles[position]);

            if (builder != null) builder.dismiss();
          }
        });

    builder.setCancelable(false);
    builder.setTitle(R.string.stringHowAboutYourMood);
    builder.setView(selectView);
    builder.setCancelable(true);
    builder.show();
  }
Ejemplo n.º 10
0
  private void reportClass(final Class<?> clazz) {
    String msg = String.format("Incompatible %s", clazz.getName());
    XUtil.log(null, Log.WARN, msg);

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle(getString(R.string.app_name));
    alertDialog.setMessage(msg);
    alertDialog.setIcon(R.drawable.ic_launcher);
    alertDialog.setButton(
        AlertDialog.BUTTON_POSITIVE,
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            sendClassInfo(clazz);
          }
        });
    alertDialog.setButton(
        AlertDialog.BUTTON_NEGATIVE,
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    alertDialog.show();
  }
Ejemplo n.º 11
0
  public void requestPassword(final Bundle savedInstanceState) {
    mPasswordView = new EditText(this);
    mPasswordView.setInputType(EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
    mPasswordView.setTransformationMethod(new PasswordTransformationMethod());

    AlertDialog alert = mAlertBuilder.create();
    alert.setTitle(R.string.enter_password);
    alert.setView(mPasswordView);
    alert.setButton(
        AlertDialog.BUTTON_POSITIVE,
        getString(R.string.okay),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            if (core.authenticatePassword(mPasswordView.getText().toString())) {
              createUI(savedInstanceState);
            } else {
              requestPassword(savedInstanceState);
            }
          }
        });
    alert.setButton(
        AlertDialog.BUTTON_NEGATIVE,
        getString(R.string.cancel),
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int which) {
            finish();
          }
        });
    alert.show();
  }
Ejemplo n.º 12
0
  @SuppressWarnings("deprecation")
  public void alert(String msg) {

    final AlertDialog alertDialog = new AlertDialog.Builder(FriendList.this).create();

    // Setting Dialog Title
    alertDialog.setTitle("VoicIt");

    // Setting Dialog Message
    alertDialog.setMessage(msg);

    // Setting Icon to Dialog
    alertDialog.setIcon(R.drawable.ic_launcher);

    // Setting OK Button
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {

            alertDialog.cancel();
          }
        });

    // Showing Alert Message
    alertDialog.show();
  }
Ejemplo n.º 13
0
 private void showExitApplicationNotification() {
   AlertDialog alertDialog = new AlertDialog.Builder(this).create();
   alertDialog.setTitle("Stop application?");
   // prevents the user from escaping the dialog by hitting the Back button
   alertDialog.setCancelable(false);
   alertDialog.setMessage(
       "Stop this application and exit?  You'll need to relaunch "
           + "the application to use it again.");
   alertDialog.setButton(
       AlertDialog.BUTTON_POSITIVE,
       "Stop and exit",
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           finishApplication();
         }
       });
   alertDialog.setButton(
       AlertDialog.BUTTON_NEGATIVE,
       "Don't stop",
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           // nothing to do here
         }
       });
   alertDialog.show();
 }
  /**
   * The Wall Of Shame
   *
   * <p>Organizations and persons listed below have violated the copyright and/or licensing of
   * BurritoRoot and have had their rights to use any part or derivative of BurritoRoot revoked.
   *
   * <p>You are scum, you steal the hard work of our developers. You even stole my non working
   * unroot code you f*cking bum.
   *
   * <p>Author of unlockroot http://www(dot)unlockroot(dot)com Liang Bing [email protected]
   * [email protected] HongKong
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    AlertDialog alertDialog1 = new AlertDialog.Builder(this).create();
    alertDialog1.setTitle("Disclaimer");
    alertDialog1.setCancelable(false);
    alertDialog1.setMessage(
        "Copyright 2011 TeamAndIRC. Using this application may void your warranty. General advice is not to root you device, however if you want to, if you understand"
            + " what you are doing, and acknowledge you will hold no one responsible for any loss or damages caused by this app, or the rooting of your device click Agree. This application is"
            + "opensource, and licensed under the GPLv3. Source is available at https://github.com/CunningLogic/BurritoRoot");
    alertDialog1.setButton(
        "Agree",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            credit();
          }
        });

    alertDialog1.setButton2(
        "Disagree!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            System.exit(0);
          }
        });

    alertDialog1.show();
  }
 public void askToDownloadFileManager() {
   AlertDialog alertDialog =
       new AlertDialog.Builder(this).setMessage(R.string.install_file_chooser_message).create();
   alertDialog.setTitle(R.string.install_file_chooser_title);
   alertDialog.setIcon(android.R.drawable.ic_menu_info_details);
   alertDialog.setButton(
       getResources().getText(R.string.ok),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           Intent marketIntent =
               new Intent(
                   Intent.ACTION_VIEW, Uri.parse("market://details?id=lysesoft.andexplorer"));
           startActivity(marketIntent);
           return;
         }
       });
   alertDialog.setButton2(
       getResources().getText(R.string.cancel),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           // do nothing
         }
       });
   alertDialog.show();
   return;
 }
Ejemplo n.º 16
0
 @Override
 public void onBackPressed() {
   AlertDialog alertDialog = new AlertDialog.Builder(activity).create();
   alertDialog.setTitle("Oops..");
   alertDialog.setMessage("Are you sure you want to quit?");
   alertDialog.setButton(
       AlertDialog.BUTTON_POSITIVE,
       "Yes",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           activity.finish();
           dialogInterface.cancel();
         }
       });
   alertDialog.setButton(
       AlertDialog.BUTTON_NEGATIVE,
       "No",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           dialogInterface.cancel();
         }
       });
   alertDialog.setCanceledOnTouchOutside(false);
   alertDialog.show();
 }
Ejemplo n.º 17
0
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_ayuda:
        AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
        alertDialog.setTitle(R.string.ayuda);
        alertDialog.setMessage(this.getString(R.string.ayuda_recordar));
        alertDialog.setButton(
            AlertDialog.BUTTON_NEUTRAL,
            this.getString(R.string.ordenar_ok_button),
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
              }
            });
        alertDialog.show();
        return true;
      case R.id.menu_estadisticas:
        EstadisticasActivity.iniciar(this, TipoJuego.RECORDAR);
        return true;
      case R.id.menu_cerrar_sesion:
        Login.getInstancia(getApplicationContext()).desloguear();
        Intent intent = new Intent(this, LogingActivity.class);
        Toast.makeText(this, R.string.cerrado_sesion, Toast.LENGTH_LONG).show();
        this.finish();

        startActivity(intent);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  private void checkWifiState() {
    // Enable WIFI.
    WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    if (wifi != null && !wifi.isWifiEnabled()) {
      AlertDialog alertDialog = new AlertDialog.Builder(this).create();
      alertDialog.setTitle("Exit");
      alertDialog.setMessage(
          "You need an internet connection to create an account. "
              + "Please enable a data connection and try again.");

      // Ok button.
      alertDialog.setButton(
          AlertDialog.BUTTON_POSITIVE,
          "Ok",
          new AlertDialog.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
              Intent intent = new Intent();
              intent.putExtra(MainActivity.EXTRA_REGISTERED, false);
              intent.putExtra(MainActivity.EXTRA_USER_ID, -1);
              setResult(Activity.RESULT_CANCELED, intent);
              finish();
            }
          });
      alertDialog.show();
    }
  }
  @Override
  public void onBackPressed() {
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Exit");
    alertDialog.setMessage("This app cannot be used without an account. Do you want to quit?");

    // Back button.
    alertDialog.setButton(
        AlertDialog.BUTTON_NEGATIVE,
        "No",
        new AlertDialog.OnClickListener() {
          @Override
          public void onClick(DialogInterface arg0, int arg1) {}
        });

    // Ok button.
    alertDialog.setButton(
        AlertDialog.BUTTON_POSITIVE,
        "Yes",
        new AlertDialog.OnClickListener() {
          @Override
          public void onClick(DialogInterface arg0, int arg1) {
            Intent intent = new Intent();
            intent.putExtra(MainActivity.EXTRA_REGISTERED, false);
            intent.putExtra(MainActivity.EXTRA_USER_ID, -1);
            setResult(Activity.RESULT_CANCELED, intent);
            finish();
          }
        });
    alertDialog.show();
  }
  /** Creates and displays dialog with the given errorMsg. */
  private void createErrorDialog(String errorMsg) {
    Collect.getInstance().getActivityLogger().logInstanceAction(this, "createErrorDialog", "show.");

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    alertDialog.setIcon(android.R.drawable.ic_dialog_info);
    alertDialog.setTitle(getString(R.string.error_occured));
    alertDialog.setMessage(errorMsg);
    DialogInterface.OnClickListener errorListener =
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int i) {
            switch (i) {
              case DialogInterface.BUTTON_POSITIVE:
                Collect.getInstance()
                    .getActivityLogger()
                    .logInstanceAction(this, "createErrorDialog", "OK");
                FormController formController = Collect.getInstance().getFormController();
                formController.jumpToIndex(currentIndex);
                break;
            }
          }
        };
    alertDialog.setCancelable(false);
    alertDialog.setButton(getString(R.string.ok), errorListener);
    alertDialog.show();
  }
 /**
  * Show a dialog to confirm exit download.
  *
  * @param message
  */
 private void pushToDialogOptions(String message) {
   alertDialog = new AlertDialog.Builder(DaisyReaderDownloadBooks.this).create();
   // Setting Dialog Title
   alertDialog.setTitle(R.string.error_title);
   // Setting Dialog Message
   alertDialog.setMessage(message);
   alertDialog.setCanceledOnTouchOutside(false);
   alertDialog.setCancelable(false);
   // Setting Icon to Dialog
   alertDialog.setIcon(R.raw.error);
   alertDialog.setButton(
       AlertDialog.BUTTON_NEGATIVE,
       DaisyReaderDownloadBooks.this.getString(R.string.no),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           mProgressDialog.show();
         }
       });
   alertDialog.setButton(
       AlertDialog.BUTTON_POSITIVE,
       DaisyReaderDownloadBooks.this.getString(R.string.yes),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           mTask.cancel(true);
         }
       });
   alertDialog.show();
 }
Ejemplo n.º 22
0
 private void quit(Boolean quitProgram) {
   if (quitProgram) {
     exit(1);
   } else {
     AlertDialog alert;
     AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
     alt_bld
         .setMessage(getString(R.string.done_watching_show))
         .setCancelable(false)
         .setPositiveButton(
             getString(R.string.yes),
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 exit(2);
               }
             })
         .setNegativeButton(
             getString(R.string.no),
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 exit(0);
               }
             });
     alert = alt_bld.create();
     alert.setTitle(showString);
     alert.setIcon(R.drawable.application_icon);
     alert.show();
   }
 }
Ejemplo n.º 23
0
  public void alerta(String menssage) {

    AlertDialog alertDialog = new AlertDialog.Builder(Body.this).create();

    // Setting Dialog Title
    alertDialog.setTitle("¿ Sabias que ?");

    // Setting Dialog Message
    alertDialog.setMessage(menssage);

    // Setting Icon to Dialog
    alertDialog.setIcon(R.drawable.orgcorazon1);
    alertDialog.setCancelable(false);

    // Setting OK Button
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            mp.stop();
          }
        });

    // Showing Alert Message
    alertDialog.show();
  }
Ejemplo n.º 24
0
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
      AlertDialog ExitAlert = new AlertDialog.Builder(this).create();
      ExitAlert.setTitle("Exit Jazeit");
      ExitAlert.setIcon(R.drawable.logo);
      ExitAlert.setMessage("Are you sure you want to exit the APP?");

      ExitAlert.setButton2(
          "Continue",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              return;
            }
          });
      ExitAlert.setButton(
          "Exit App",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              // finish();
              finish();
              return;
            }
          });
      ExitAlert.show();
    }

    return false;
  }
  public void credit() {
    AlertDialog alertDialog2 = new AlertDialog.Builder(this).create();
    alertDialog2.setTitle("Credit");
    alertDialog2.setCancelable(false);
    alertDialog2.setMessage(
        "Justin Case (jcase) :Theory, Exploit and Code.\n\n"
            + "Vashypooh :Bugging the shit out of jcase and testing\n\n"
            + "Trevor Eckhart :Testing\n\n"
            + "IOMoster :Pointing out my stupid mistake that kept this from working.\n\n"
            + "AndroidPolice.com for support all my efforts, no matter how drunk I am.\n\n"
            + "RootzWiki.com for giving me support and a home on the net.");
    alertDialog2.setButton(
        "You Rock",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            root();
          }
        });

    alertDialog2.setButton2(
        "You Suck!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            System.exit(0);
          }
        });

    alertDialog2.show();
  }
Ejemplo n.º 26
0
  @SuppressWarnings("deprecation")
  @Override
  public void onBackPressed() {

    if (Flag_BackPress.equalsIgnoreCase("Timefeed")) {
      AlertDialog alert_back = new AlertDialog.Builder(this).create();
      alert_back.setTitle("Exit?");
      alert_back.setMessage("Are you sure want to exit?");

      alert_back.setButton(
          "No",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              dialog.dismiss();
            }
          });

      alert_back.setButton2(
          "Yes",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              MainActivity.this.finish();
            }
          });
      alert_back.show();

    } else {
      displayView(2);
    }
  }
  public void root() {
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Now What?");
    alertDialog.setCancelable(false);
    alertDialog.setMessage("What do you want to do?");
    alertDialog.setButton(
        "Root",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            try {
              sendBroadcast(
                  new Intent("com.amazon.internal.E_COMMAND").putExtra("cmd", "adbd_start"));
              post();
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });

    alertDialog.setButton3(
        "Exit",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            System.exit(0);
          }
        });
    alertDialog.show();
  }
Ejemplo n.º 28
0
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case DialogId.DIALOG_ALERT_FREQUENCY:
     case DialogId.DIALOG_ALERT_FREQUENCY_NULL:
     case DialogId.DIALOG_ALERT_SYMBOL:
     case DialogId.DIALOG_ALERT_SYMBOL_NULL:
     case DialogId.DIALOG_ALERT_SYMBOL_OUT:
       AlertDialog alert =
           new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_DARK).create();
       alert.setTitle(getResources().getString(R.string.alert));
       alert.setOnKeyListener(
           new OnKeyListener() {
             public boolean onKey(DialogInterface arg0, int arg1, KeyEvent event) {
               // 任意按键都能让提示对话框消失
               if (event.getAction() == KeyEvent.ACTION_DOWN) {
                 arg0.dismiss();
               }
               return true;
             }
           });
       // 这个是用来在组装对话框时必须的,用来显示消息内容
       // 可以在onPrepareDialog中改变的,如果这里没有那么
       // 对话框就没这个组件了
       alert.setMessage("");
       return alert;
   }
   return super.onCreateDialog(id);
 }
Ejemplo n.º 29
0
  private void createAlertDialog(String message) {
    Collect.getInstance().getActivityLogger().logAction(this, "createAlertDialog", "show");

    mAlertDialog = new AlertDialog.Builder(this).create();
    mAlertDialog.setTitle(getString(R.string.upload_results));
    mAlertDialog.setMessage(message);
    DialogInterface.OnClickListener quitListener =
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int i) {
            switch (i) {
              case DialogInterface.BUTTON_POSITIVE: // ok
                Collect.getInstance()
                    .getActivityLogger()
                    .logAction(this, "createAlertDialog", "OK");
                // always exit this activity since it has no interface
                mAlertShowing = false;
                finish();
                break;
            }
          }
        };
    mAlertDialog.setCancelable(false);
    mAlertDialog.setButton(getString(R.string.ok), quitListener);
    mAlertDialog.setIcon(android.R.drawable.ic_dialog_info);
    mAlertShowing = true;
    mAlertMsg = message;
    mAlertDialog.show();
  }
Ejemplo n.º 30
0
  private void showAlertDialog() {
    // TODO Auto-generated method stub
    AlertDialog alert = new AlertDialog.Builder(SchoolName.this).create();
    alert.setTitle(getString(R.string.Registration_through_Facebook_is_successful));
    alert.setMessage(getString(R.string.Check_your_email_to_verify_your_account));
    alert.setButton(
        getString(R.string.OK),
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            /*
            Bundle extras = new Bundle();
            extras.putString("registered_email", email);
            Intent i = new Intent(getApplicationContext(), CheckEmail.class);
            i.putExtras(extras);
            startActivity(i);
            */

            trialLogin();
          }
        });

    alert.show();
  }