示例#1
0
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   super.onPrepareDialog(id, dialog);
   switch (id) {
     case DIALOG_DELETE_ITEMS:
       String msg = "";
       if (mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_TODOS) {
         if (mTodosListAdapter.getSeletedTodosNumber() > 1) {
           msg = getString(R.string.delete_selected_items);
         } else {
           msg = getString(R.string.delete_item);
         }
         ((AlertDialog) dialog).setMessage(msg);
       } else if (mTodosListAdapter.getEditType() == TodosListAdapter.EDIT_DONES) {
         if (mTodosListAdapter.getSeletedDonesNumber() > 1) {
           msg = getString(R.string.delete_selected_items);
         } else {
           msg = getString(R.string.delete_item);
         }
         ((AlertDialog) dialog).setMessage(msg);
       }
       break;
     default:
       break;
   }
 }
示例#2
0
  public void prepareDialog(int id, Dialog dialog) {

    if (id == DIALOG_ERROR_WRITING) {
      ((AlertDialog) dialog).setMessage(errorMsg);
      DialogHelper.savedDialog = DIALOG_ERROR_WRITING;
    } else if (id == DIALOG_INFO) {
      ((AlertDialog) dialog).setMessage(infoMsg);
      Emulator.pause();
      DialogHelper.savedDialog = DIALOG_INFO;
    } else if (id == DIALOG_THANKS) {
      Emulator.pause();
      DialogHelper.savedDialog = DIALOG_THANKS;
    } else if (id == DIALOG_EXIT_GAME) {
      Emulator.pause();
      DialogHelper.savedDialog = DIALOG_EXIT_GAME;
    } else if (id == DIALOG_OPTIONS) {
      Emulator.pause();
      DialogHelper.savedDialog = DIALOG_OPTIONS;
    } else if (id == DIALOG_FULLSCREEN) {
      Emulator.pause();
      DialogHelper.savedDialog = DIALOG_FULLSCREEN;
    } else if (id == DIALOG_ROMs_DIR) {
      DialogHelper.savedDialog = DIALOG_ROMs_DIR;
    } else if (id == DIALOG_LOAD_FILE_EXPLORER) {
      DialogHelper.savedDialog = DIALOG_LOAD_FILE_EXPLORER;
    } else if (id == DIALOG_FINISH_CUSTOM_LAYOUT) {
      DialogHelper.savedDialog = DIALOG_FINISH_CUSTOM_LAYOUT;
    }
  }
  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;
    }
  }
示例#4
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();
  }
  private void onAddPartnerBtClick(int mid, int pid) {
    new AddPartnerThreads(getString(R.string.server_ip), mid, pid).start();

    while (result.equals("waiting")) ;

    if (result.equals("success")) {
      AlertDialog ad = new AlertDialog.Builder(this).setTitle("消息").create();
      ad.setMessage(
          result
              + "!\n你的队伍:"
              + MyGroupListAdapter.groupDataList.get(MyGroups.currentPosition).groupName
              + "已经成功与"
              + datai.groupName
              + "确定联谊,请去消息页面与对方联系活动细节...");
      ad.show();
    } else {
      AlertDialog ad = new AlertDialog.Builder(this).setTitle("消息").create();
      ad.setMessage(
          "Unfortunately!\n你的队伍:"
              + MyGroupListAdapter.groupDataList.get(MyGroups.currentPosition).groupName
              + "没能与"
              + datai.groupName
              + "确定联谊,请重新选择伙伴...");
      ad.show();
    }
  }
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   AlertDialog alertDialog = (AlertDialog) dialog;
   switch (id) {
     case DialogId.DIALOG_ALERT_FREQUENCY:
       alertDialog.setMessage(getResources().getString(R.string.frequency_out_of_range));
       break;
     case DialogId.DIALOG_ALERT_FREQUENCY_NULL:
       alertDialog.setMessage(getResources().getString(R.string.frequency_null));
       break;
       /*case DialogId.DIALOG_ALERT_SYMBOL:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_of_range));
       break;*/
     case DialogId.DIALOG_ALERT_SYMBOL_NULL:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_null));
       break;
     case DialogId.DIALOG_ALERT_SYMBOL_OUT:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_range));
       break;
   }
   Message msg = new Message();
   msg.what = DIALOG_ALERT_DISMISS;
   msg.arg1 = id;
   mainHandler.sendMessageDelayed(msg, 3000);
   log.D("message: dismiss dialog" + msg.arg1);
   super.onPrepareDialog(id, dialog);
 }
示例#7
0
 @Override
 public void handleMessage(Message msg) {
   // TODO Auto-generated method stub
   switch (msg.what) {
     case uSDKNotificationCenter.DEVICE_STATUS_CHANGED_NOTIFY:
       HashMap<String, HashMap<String, uSDKDeviceAttribute>> maps =
           (HashMap<String, HashMap<String, uSDKDeviceAttribute>>) msg.obj;
       HashMap<String, uSDKDeviceAttribute> attrs = maps.get(mDevice.getDeviceMac());
       mHandler.obtainMessage(Const.MSG_DEVICE_ATTRIBUTE_CHANGE, attrs).sendToTarget();
       Log.d(
           "test",
           "DEVICE_STATUS_CHANGED_NOTIFY  mDevice.size-->" + mDevice.getAttributeMap());
       initDeviceInfo(mDevice.getAttributeMap());
       break;
     case uSDKNotificationCenter.DEVICE_OPERATION_ACK_NOTIFY:
       HashMap<Integer, HashMap<String, uSDKDeviceAttribute>> cmd_maps =
           (HashMap<Integer, HashMap<String, uSDKDeviceAttribute>>) msg.obj;
       HashMap<String, uSDKDeviceAttribute> res_maps = cmd_maps.get(1000);
       initDeviceInfo(mDevice.getAttributeMap());
       break;
     case uSDKNotificationCenter.DEVICE_ALARM_NOTIFY:
       Log.d("test", "DEVICE_ALARM_NOTIFY ");
       HashMap<String, ArrayList<uSDKDeviceAlarm>> alarmList =
           (HashMap<String, ArrayList<uSDKDeviceAlarm>>) msg.obj;
       ArrayList<uSDKDeviceAlarm> deviceAlarmList = alarmList.get(mDevice.getDeviceMac());
       if (deviceAlarmList != null && deviceAlarmList.size() > 0) {
         String alarmContent = "";
         for (uSDKDeviceAlarm ala : deviceAlarmList) {
           alarmContent += ala.getAlarmMessage();
         }
         if (mAlarmDialog != null) {
           if (mAlarmDialog.isShowing()) {
             mAlarmDialog.setMessage(oldAlarmContent + "\n" + alarmContent);
             oldAlarmContent = oldAlarmContent + "\n" + alarmContent;
           } else {
             mAlarmDialog.setMessage(alarmContent);
             mAlarmDialog.show();
             oldAlarmContent = alarmContent;
           }
         } else {
           mAlarmDialog = getAlarmDialog(alarmContent.toString());
           mAlarmDialog.show();
           oldAlarmContent = alarmContent;
         }
       }
       break;
     case uSDKNotificationCenter.DEVICE_ONLINE_CHANGED_NOTIFY:
       HashMap<String, uSDKDeviceStatusConst> map =
           (HashMap<String, uSDKDeviceStatusConst>) msg.obj;
       if (map != null && map.size() > 0) {
         uSDKDeviceStatusConst online = map.get(mDeviceMac);
         if (online != null) {
           Toast.makeText(OvenControlFragment.this, "当前的设备装备:" + online.getValue(), 3000)
               .show();
         }
       }
       break;
   }
 }
  @Override
  public void onClick(View v) {
    if (v == mSave) {
      save();
    } else if (v == mDefaults) {
      loadData(true);
      mHasChanges = true;
      updateButtons();
    } else if (v == mReload) {
      loadData(false);
      mHasChanges = false;
      updateButtons();
    } else if (v == mNumLevels) {
      mDialog.setMessage(2 + " - " + mSensorRange);
      mEditor.setText(String.valueOf(mLevels.length + 1));
      mEditor.selectAll();
      mEditedId = -1337;
      mDialog.show();
    } else {
      int id = v.getId();
      int value = -1;
      int min = 0;
      int max = 0;
      if (id >= 2000 && id < 3000) {
        value = mLevels[id - 2000];
        min = 0;
        max = mSensorRange;
      } else if (id >= 3000 && id < 4000) {
        value = mLcdValues[id - 3000];
        min =
            Settings.System.getInt(
                getContentResolver(),
                Settings.System.LIGHT_SCREEN_DIM,
                android.os.Power.BRIGHTNESS_DIM);
        max = android.os.Power.BRIGHTNESS_ON;
      } else if (id >= 4000 && id < 5000) {
        value = mBtnValues[id - 4000];
        min = android.os.Power.BRIGHTNESS_OFF;
        max = android.os.Power.BRIGHTNESS_ON;
      } else if (id >= 5000 && id < 6000) {
        value = mKbValues[id - 5000];
        min = android.os.Power.BRIGHTNESS_OFF;
        max = android.os.Power.BRIGHTNESS_ON;
      } else {
        value = -1;
      }

      if (value >= 0) {
        mDialog.setMessage(min + " - " + max);
        mEditor.setText(String.valueOf(value));
        mEditor.selectAll();
        mEditedId = id;
        mDialog.show();
      }
    }
  }
示例#9
0
 /**
  * M: update the message of dialog, single/multi file/files to be deleted
  *
  * @param single if single file to be deleted
  */
 public void setSingle(boolean single) {
   AlertDialog dialog = (AlertDialog) getDialog();
   if (null != dialog) {
     if (single) {
       dialog.setMessage(getString(R.string.alert_delete_single));
     } else {
       dialog.setMessage(getString(R.string.alert_delete_multiple));
     }
   }
 }
示例#10
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;
    }
  }
示例#11
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;
  }
示例#12
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();
  }
示例#13
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();
  }
  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();
    }
  }
示例#15
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();
  }
示例#16
0
  @Override
  public boolean OnVerifiyCertificate(String subject, String issuer, String fingerprint) {

    // see if global settings says accept all
    if (GlobalSettings.getAcceptAllCertificates()) return true;

    // this is where the return code of our dialog will be stored
    callbackDialogResult = false;

    // set message
    String msg = getResources().getString(R.string.dlg_msg_verify_certificate);
    msg = msg + "\n\nSubject: " + subject + "\nIssuer: " + issuer + "\nFingerprint: " + fingerprint;
    dlgVerifyCertificate.setMessage(msg);

    // start dialog in UI thread
    uiHandler.sendMessage(Message.obtain(null, UIHandler.SHOW_DIALOG, dlgVerifyCertificate));

    // wait for result
    try {
      synchronized (dlgVerifyCertificate) {
        dlgVerifyCertificate.wait();
      }
    } catch (InterruptedException e) {
    }

    return callbackDialogResult;
  }
 /**
  * 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();
 }
示例#18
0
 @Override
 protected Dialog onCreateDialog(int id, Bundle args) {
   if (!haveDestroy) {
     Dialog dialog = null;
     switch (id) {
       case DIALOG_MESSAGE:
         AlertDialog messageDialog = new AlertDialog.Builder(this).create();
         if (args != null) {
           messageDialog.setMessage(args.getString(KEY_DIALOG_MESSAGE));
           messageDialog.setButton(
               AlertDialog.BUTTON_POSITIVE,
               args.getString(KEY_DIALOG_CONFRIM_BUTTON_NAME),
               new android.content.DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {}
               });
         }
         dialog = messageDialog;
         break;
       case DIALOG_PROGRESS:
         ProgressDialog progressDialog = new ProgressDialog(this);
         progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
         progressDialog.setCancelable(false);
         if (args != null) {
           progressDialog.setMessage(args.getString(KEY_DIALOG_MESSAGE));
         }
         dialog = progressDialog;
         break;
     }
     return dialog;
   } else {
     return null;
   }
 }
示例#19
0
  /**
   * Creates a dialog with the given message. Will exit the activity when the user preses "ok" if
   * shouldExit is set to true.
   *
   * @param errorMsg
   * @param shouldExit
   */
  private void createErrorDialog(String errorMsg, final boolean shouldExit) {

    Collect.getInstance().getActivityLogger().logAction(this, "createErrorDialog", "show");

    mAlertDialog = new AlertDialog.Builder(this).create();
    mAlertDialog.setIcon(android.R.drawable.ic_dialog_info);
    mAlertDialog.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()
                    .logAction(this, "createErrorDialog", shouldExit ? "exitApplication" : "OK");
                if (shouldExit) {
                  finish();
                }
                break;
            }
          }
        };
    mAlertDialog.setCancelable(false);
    mAlertDialog.setButton(getString(R.string.ok), errorListener);
    mAlertDialog.show();
  }
    protected void onPostExecute(Boolean result) {
      DLog.LOGD("LoadTrackerTask::onPostExecute: execution " + (result ? "successful" : "failed"));

      if (result) {
        // Done loading the tracker, update application status:
        updateApplicationStatus(AppStatus.APPSTATUS_INITED);
      } else {
        // Create dialog box for display error:
        AlertDialog dialogError = new AlertDialog.Builder(CopyOfQCARInitActivity_xxx.this).create();

        dialogError.setButton(
            DialogInterface.BUTTON_POSITIVE,
            "Close",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                // Exiting application:
                System.exit(1);
              }
            });

        // Show dialog box with error message:
        dialogError.setMessage("Failed to load tracker data.");
        dialogError.show();
      }
    }
 @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();
 }
示例#22
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);
    }
  }
  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();
  }
  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();
  }
  public void makePhoneCall(final String phoneNumber) {
    AlertDialog phoneCall = new AlertDialog.Builder(CommonPlaceDetailActivity.this).create();
    phoneCall.setMessage(getResources().getString(R.string.make_phone_call) + "\n" + phoneNumber);
    phoneCall.setButton(
        DialogInterface.BUTTON_POSITIVE,
        getResources().getString(R.string.call),
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(Intent.ACTION_CALL);
            intent.setData(Uri.parse("tel:" + phoneNumber));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            CommonPlaceDetailActivity.this.startActivity(intent);
          }
        });
    phoneCall.setButton(
        DialogInterface.BUTTON_NEGATIVE,
        "" + getBaseContext().getString(R.string.cancel),
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
          }
        });
    phoneCall.show();
  }
示例#26
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);
 }
  /**
   * 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();
  }
示例#28
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;
  }
  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();
  }
示例#30
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();
  }