コード例 #1
0
        @Override
        public void run() {
          numberDisable = true;
          long millsInFature = 0;
          if (bIsFalseStart) {
            bIsFalseStart = false;
            long defauleTime =
                new Date().getTime() - appLockApplication.getLastAppEnterPwdLeaverDateMiliseconds();
            if (defauleTime < appLockApplication.getLastAppEnterPwdDelayTime() * 1000) {
              millsInFature = appLockApplication.getLastAppEnterPwdDelayTime() * 1000 - defauleTime;
            }
          } else {
            millsInFature = delayTime[errorCount] + 1;
          }
          LogUtil.e("colin", "attemptLockout处理:" + millsInFature);
          mCountdownTimer =
              new CountDownTimer(millsInFature, 1000) {

                @Override
                public void onTick(long millisUntilFinished) {
                  int secondsRemaining = (int) (millisUntilFinished / 1000) - 1;
                  lastDelayTime = secondsRemaining;
                  if (secondsRemaining > 0) {
                    String format = getResources().getString(R.string.password_time);
                    String str = String.format(format, secondsRemaining);
                    mHeadTextView.setText(str);
                  } else {
                    mHeadTextView.setText(R.string.num_create_text_01);
                    mHeadTextView.setTextColor(Color.WHITE);
                  }
                }

                @Override
                public void onFinish() {
                  for (ImageView iv : pointList) {
                    iv.setImageResource(R.drawable.num_point);
                  }
                  numberDisable = false;
                  mFailedPatternAttemptsSinceLastTimeout = 0;
                  errorCount += 1;
                  if (errorCount > 4) {
                    errorCount = 0;
                  }
                }
              }.start();
        }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_num_check);

    pService = new LookMyPrivateService(getApplicationContext());
    playWarringSoundService = new PlayWarringSoundService(getApplicationContext());
    surfaceView = (SurfaceView) findViewById(R.id.picSurfaceView);
    cameraFuncation = new CameraFuncation(getApplicationContext(), surfaceView, pService);
    mHeadTextView = (TextView) findViewById(R.id.tv_text);
    mShakeAnim = AnimationUtils.loadAnimation(this, R.anim.shake_x);
    iv_user_check = (ImageView) findViewById(R.id.iv_user_check);

    initNumLayout();
    changeFlag = getIntent().getBooleanExtra(CHANGE_PASSWORD, false);
    unGoHome = changeFlag;
    VisitorModelService visitorModelService = new VisitorModelService(getApplicationContext());
    if (changeFlag || !visitorModelService.hasLockedPackage()) {
      findViewById(R.id.btn_user_model).setVisibility(View.INVISIBLE);
    } else if (AppLockApplication.getInstance().getVisitorState()) {
      findViewById(R.id.btn_user_check).setVisibility(View.VISIBLE);
      if (SharedPreferenceUtil.readUnlockUserByEnter()) {
        iv_user_check.setImageResource(R.drawable.checkbox_select);
      } else {
        iv_user_check.setImageResource(R.drawable.checkbox_unselect);
      }
    }

    bPwdIsCorrent = appLockApplication.getLastAppEnterCorrentPwd();
    errorCount = appLockApplication.getLastAppEnterPwdErrorCount();
    if (!bPwdIsCorrent) {
      bIsFalseStart = true;
      long defauleTime =
          new Date().getTime() - appLockApplication.getLastAppEnterPwdLeaverDateMiliseconds();
      LogUtil.e(
          "colin",
          "上次解锁密码错误,到现在的时间为:"
              + defauleTime
              + "上次时间为:"
              + appLockApplication.getLastAppEnterPwdDelayTime());
      if (defauleTime < appLockApplication.getLastAppEnterPwdDelayTime() * 1000) {
        LogUtil.e("colin", "上次解锁密码错误,时间孙艳");
        mHandler.postDelayed(attemptLockout, 100);
      } else {
        LogUtil.e("colin", "上次解锁密码错误,时间不孙艳");
        bIsFalseStart = false;
        errorCount += 1;
        if (errorCount > 4) {
          errorCount = 0;
        }
        appLockApplication.setLastAppEnterPwdErrorCount(errorCount);
      }
    }

    // pop
    popView = findViewById(R.id.layout_pop);
    actionView = (ActionView) findViewById(R.id.btn_more);

    initAnim();
    String secretQuestion = AppLockApplication.getInstance().getSecretQuestionString();
    if (!TextUtils.isEmpty(secretQuestion)) {
      actionView.setVisibility(View.VISIBLE);
    } else {
      actionView.setVisibility(View.INVISIBLE);
    }
    super.onCreate(savedInstanceState);
  }