Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //pops up the dialog
- @Override
- protected Dialog onCreateDialog(int id) {
- Dialog returndialog = new Dialog(getApplicationContext());
- switch (id) {
- case DATE_DIALOG_ID:
- DatePickerDialog dialog = new DatePickerDialog(this,
- mDateSetListener, bYear, bMonth, bDay) {
- @Override
- public boolean onSearchRequested() {
- return false;
- }
- };
- dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_NEGATIVE) {
- Log.e(TAG, "Permission Denied - You aren't allowed to use this app yet [TERMINATED]");
- System.exit(0);
- }
- }
- });
- dialog.setCancelable(false);
- returndialog = dialog;
- break;
- case EXPIRATION_DIALOG_ID:
- final GregorianCalendar now = new GregorianCalendar();
- AlertDialog alertDialog =new AlertDialog(getApplicationContext()) {
- @Override
- public boolean onSearchRequested() {
- return false;
- }
- };
- Log.w(TAG, "Has this build expired? " + now.after(expiration));
- if (now.after(expiration)) {
- alertDialog.setTitle("Application Expired");
- alertDialog
- .setMessage("This alpha release expired "
- + DateFormat.getDateInstance()
- .format(expiration.getTime())
- + ".\nThe application will now close, please check with Mgamerz for more updated alpha releases.");
- } else {
- alertDialog.setTitle("Notice");
- alertDialog.setMessage("This alpha release will expire on "
- + DateFormat.getDateInstance().format(expiration
- .getTime()));
- }
- alertDialog.setCancelable(false);
- alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new AlertDialog.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Log.d(TAG, "Expiration OnClick");
- if (now.after(expiration)) {
- System.exit(0);
- expirationAlert = true;
- dialog.dismiss();
- } else {
- if (!now.after(expiration)) {
- expirationAlert = false;
- }
- dialog.dismiss();
- }
- }
- });
- returndialog = alertDialog;
- break;
- }
- return returndialog;
- }
Advertisement
Add Comment
Please, Sign In to add comment