@Override public void onPatternDetected(List<LockPatternView.Cell> pattern) { switch (lockPatternType) { case CREATE_PATTERN: doCheckAndCreatePattern(pattern); break; case COMPARE_PATTERN: doComparePattern(pattern); break; case VERIFY_CAPTCHA: if (!LockPatternView.DisplayMode.Animate.equals(lockPatternView.getDisplayMode())) { doComparePattern(pattern); } break; } onPatternDetected(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); } }