Ejemplo n.º 1
0
 void checkVersion() {
   AppLockApplication appLockApplication = AppLockApplication.getInstance();
   if (appLockApplication.hasNewVersion()) {
     downLoadFileUrl = appLockApplication.getUpdateVersionUrl();
     showUpdateDialog(appLockApplication.getUpdateVersionIntro());
   } else {
     ToastUtils.showToast(R.string.no_new_version);
   }
 }
  private void doForResult(InputResult result) {
    switch (result) {
      case CONTINUE:
        break;
      case SUCCESS:
        unGoHome = true;
        bPwdIsCorrent = true;
        if (changeFlag) {
          Intent intent = new Intent(NumberCheckActivity.this, NumberCreateActivity.class);
          intent.putExtra(GestureCreateActivity.CHANGE_FLAG, true);
          startActivity(intent);
        } else {
          if (AppLockApplication.getInstance().getVisitorState()
              && SharedPreferenceUtil.readUnlockUserByEnter()) {
            AppLockApplication.getInstance().setVisitorState(false);
          }
          Intent intent = new Intent(NumberCheckActivity.this, LockMainActivity.class);
          AppLockApplication.getInstance().setStartGuide(true);
          startActivity(intent);
        }
        finish();
        break;

      case ERROR:
        bPwdIsCorrent = false;
        mFailedPatternAttemptsSinceLastTimeout++;
        int retry =
            LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT
                - mFailedPatternAttemptsSinceLastTimeout;
        if (retry >= 0) {
          if (retry == 0)
            ToastUtils.showToast(
                String.format(
                    getResources().getString(R.string.password_error_wait),
                    delayTime[errorCount] / 1000 / 60));
          String format = getResources().getString(R.string.password_error_count);
          String str = String.format(format, retry);
          mHeadTextView.setText(str);
          mHeadTextView.setTextColor(getResources().getColor(R.color.text_red));
          mHeadTextView.startAnimation(mShakeAnim);
        }

        if (mFailedPatternAttemptsSinceLastTimeout >= 3) {
          LookMyPrivate lookMyPrivate = new LookMyPrivate();
          lookMyPrivate.setLookDate(new Date());
          lookMyPrivate.setResolver("com.cleanwiz.applock");
          long id = pService.addNewLookMyPrivate(lookMyPrivate);
          lookMyPrivate.setId(id);
          if (appLockApplication.getAutoRecordPic()) {
            if (cameraFuncation != null) {
              cameraFuncation.lookMyPrivate = lookMyPrivate;
              LogUtil.e("colin", "解锁失败,拍照来哦啦");
              cameraFuncation.tackPicture();
            }
          }
          // 播放声音
          if (appLockApplication.getPlayWarringSoundState()) {
            playWarringSoundService.playSound();
          }
        }
        if (mFailedPatternAttemptsSinceLastTimeout
            >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
          mHandler.postDelayed(attemptLockout, 2000);
        } else {
          numberDisable = true;
          mHandler.postDelayed(clearPassword, 2000);
        }

        break;

      default:
        break;
    }
  }