public void setLockPatternType(LockPatternType lockPatternType) { this.lockPatternType = lockPatternType; if (lockPatternType == LockPatternType.VERIFY_CAPTCHA) { final ArrayList<LockPatternView.Cell> pattern; if (getIntent().hasExtra(EXTRA_PATTERN)) { pattern = getIntent().getParcelableArrayListExtra(EXTRA_PATTERN); } else { getIntent() .putParcelableArrayListExtra( EXTRA_PATTERN, pattern = LockPatternUtils.genCaptchaPattern(captchaWiredDots)); } lockPatternView.setPattern(LockPatternView.DisplayMode.Animate, pattern); } }
@Override public void onPatternCleared() { lockPatternView.removeCallbacks(mLockPatternViewReloader); switch (lockPatternType) { case CREATE_PATTERN: case COMPARE_PATTERN: lockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct); break; case VERIFY_CAPTCHA: List<LockPatternView.Cell> pattern = getIntent().getParcelableArrayListExtra(EXTRA_PATTERN); lockPatternView.setPattern(LockPatternView.DisplayMode.Animate, pattern); break; } onPatternCleared(lockPatternType); }
protected final void init(LockPatternView lockPatternView) { this.lockPatternView = lockPatternView; initLockPatternType(); initSettings(); initLockPatternView(); if (lockPatternType == LockPatternType.VERIFY_CAPTCHA) { final ArrayList<LockPatternView.Cell> pattern; if (getIntent().hasExtra(EXTRA_PATTERN)) { pattern = getIntent().getParcelableArrayListExtra(EXTRA_PATTERN); } else { getIntent() .putParcelableArrayListExtra( EXTRA_PATTERN, pattern = LockPatternUtils.genCaptchaPattern(captchaWiredDots)); } lockPatternView.setPattern(LockPatternView.DisplayMode.Animate, pattern); } onInit(lockPatternType); }
private final void initLockPatternView() { LockPatternView.DisplayMode lastDisplayMode = lockPatternView != null ? lockPatternView.getDisplayMode() : null; List<LockPatternView.Cell> lastPattern = lockPatternView != null ? lockPatternView.getPattern() : null; switch (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) { case Configuration.SCREENLAYOUT_SIZE_LARGE: case Configuration.SCREENLAYOUT_SIZE_XLARGE: { final int size = getResources().getDimensionPixelSize(R.dimen.lock_pattern_view_size); ViewGroup.LayoutParams lp = lockPatternView.getLayoutParams(); lp.width = size; lp.height = size; lockPatternView.setLayoutParams(lp); break; } // LARGE / XLARGE } boolean hapticFeedbackEnabled = false; try { hapticFeedbackEnabled = Settings.System.getInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0; } catch (Throwable t) { /** Ignore it. */ } lockPatternView.setTactileFeedbackEnabled(hapticFeedbackEnabled); lockPatternView.setOnPatternListener(this); lockPatternView.setInStealthMode( stealthMode && lockPatternType != LockPatternType.VERIFY_CAPTCHA); if (lastPattern != null && lastDisplayMode != null && lockPatternType != LockPatternType.VERIFY_CAPTCHA) { lockPatternView.setPattern(lastDisplayMode, lastPattern); } }