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; } }
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub SwitchButton switchButton = (SwitchButton) buttonView; LogUtil.e("colin", "switch is changed:" + switchButton.getId()); switch (switchButton.getId()) { case 2: // 启用加锁 { boolean bIsState = !switchButton.isChecked(); appLockApplication.setAppLockState(bIsState); break; } case 8: // 新应用加锁提示 { break; } case 9: // 允许短暂退出 { boolean bIsState = !switchButton.isChecked(); appLockApplication.setAllowedLeaveAment(bIsState); Intent intent = new Intent(LockService.LOCK_SERVICE_LEAVEAMENT); intent.putExtra(LockService.LOCK_SERVICE_LEAVEAMENT, bIsState); sendBroadcast(intent); LogUtil.d("demo3", "bIsState:" + bIsState); break; } case 11: // 锁锁图标的隐藏和显示 { setHideAppIcon(); break; } case 12: // 防卸载 { if (!switchButton.isChecked() && !devicePolicyManager.isAdminActive(componentName)) { enableDeviceManager(); } else if (switchButton.isChecked() && devicePolicyManager.isAdminActive(componentName)) { disableDeviceManager(); } break; } case 18: // 自动拍照 { appLockApplication.setAutoRecordPic(!switchButton.isChecked()); if (appLockApplication.getAutoRecordPic()) { WarringDialog warringDialog = new WarringDialog(); warringDialog.switchButton = switchButton; warringDialog.show(); } break; } case 19: // 播放告警声音 { appLockApplication.setPlayWarringSoundState(!switchButton.isChecked()); break; } default: break; } appSettingAdapter.notifyDataSetChanged(); }