@Override
  protected void onResume() {
    super.onResume();
    // TODO Auto-generated method stub
    if (!PreyStatus.getInstance().isPreyConfigurationActivityResume()) {
      Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      intent.putExtra("EXIT", true);
      try {
        startActivity(intent);
      } catch (Exception e) {
      }
      finish();
    }
    try {
      if (PreyEmail.getEmail(getApplicationContext()) != null) {
        PreferenceCategory mCategory = (PreferenceCategory) findPreference("PREFS_CAT_PREFS");
        Preference p2 = findPreference(PreyConfig.PREFS_SCHEDULED);
        mCategory.removePreference(p2);
      }
    } catch (Exception e) {
    }

    PreyConfig preyConfig = PreyConfig.getPreyConfig(getApplicationContext());
    Preference p = findPreference("PREFS_ADMIN_DEVICE");
    if (preyConfig.isFroyoOrAbove()) {

      if (FroyoSupport.getInstance(getApplicationContext()).isAdminActive()) {
        p.setTitle(R.string.preferences_admin_enabled_title);
        p.setSummary(R.string.preferences_admin_enabled_summary);
      } else {
        p.setTitle(R.string.preferences_admin_disabled_title);
        p.setSummary(R.string.preferences_admin_disabled_summary);
      }
    } else p.setEnabled(false);

    p = findPreference("PREFS_ABOUT");
    p.setSummary("Version " + preyConfig.getPreyVersion() + " - Prey Inc.");

    Preference pGo = findPreference("PREFS_GOTO_WEB_CONTROL_PANEL");
    pGo.setOnPreferenceClickListener(
        new Preference.OnPreferenceClickListener() {

          public boolean onPreferenceClick(Preference preference) {

            String url = PreyConfig.getPreyConfig(getApplicationContext()).getPreyPanelUrl();
            PreyLogger.d("url control:" + url);
            Intent internetIntent = new Intent(Intent.ACTION_VIEW);
            internetIntent.setData(Uri.parse(url));
            try {
              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
              startActivity(intent);
            } catch (Exception e) {
            }
            return false;
          }
        });
  }
 @Override
 public void onPasswordSucceeded(Context context, Intent intent) {
   PreyConfig preyConfig = PreyConfig.getPreyConfig(context);
   if (preyConfig.isLockSet()) {
     PreyLogger.d("Password was entered successfully");
     ArrayList<String> modulesList = new ArrayList<String>();
     modulesList.add(LockAction.DATA_ID);
     PreyWebServices.getInstance().deactivateModules(context, modulesList);
     preyConfig.setLock(false);
     FroyoSupport.getInstance(context).changePasswordAndLock("", false);
   }
 }
 @Override
 public void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   PreyConfig preyConfig = PreyConfig.getPreyConfig(ctx);
   if (preyConfig.isFroyoOrAbove()) {
     if (FroyoSupport.getInstance(ctx).isAdminActive()) {
       builder.setTitle(R.string.preferences_admin_enabled_dialog_title);
       builder.setMessage(R.string.preferences_admin_enabled_dialog_message);
     } else {
       builder.setTitle(R.string.preferences_admin_disabled_dialog_title);
       builder.setMessage(R.string.preferences_admin_disabled_dialog_message);
     }
   }
 }
  @Override
  public void onClick(DialogInterface dialog, int which) {
    super.onClick(dialog, which);

    if (which == DialogInterface.BUTTON_POSITIVE) {
      PreyConfig preyConfig = PreyConfig.getPreyConfig(ctx);
      if (preyConfig.isFroyoOrAbove()) {
        FroyoSupport fSupport = FroyoSupport.getInstance(ctx);
        if (fSupport.isAdminActive()) {
          fSupport.removeAdminPrivileges();
          setTitle(R.string.preferences_admin_disabled_title);
          setSummary(R.string.preferences_admin_disabled_summary);
        } else {
          Intent intent = fSupport.getAskForAdminPrivilegesIntent();
          ctx.startActivity(intent);
        }
      }
    }
  }
 @Override
 public CharSequence onDisableRequested(Context context, Intent intent) {
   FroyoSupport.getInstance(context).lockNow();
   return context.getText(R.string.preferences_admin_enabled_dialog_message).toString();
 }