コード例 #1
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   cameraFuncation.clearCamera();
   appLockApplication.setLastAppEnterPwdState(
       bPwdIsCorrent, new Date().getTime(), errorCount, lastDelayTime);
   if (mCountdownTimer != null) mCountdownTimer.cancel();
 }
コード例 #2
0
 @Override
 protected void onStop() {
   cameraFuncation.clearCamera();
   appLockApplication.setLastAppEnterPwdState(
       bPwdIsCorrent, new Date().getTime(), errorCount, lastDelayTime);
   if (!unGoHome) {
     AppLockApplication.getInstance().goHome(this);
   }
   super.onStop();
 }
コード例 #3
0
  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;
    }
  }