@Override
 public void onPatternDetected(List<Cell> pattern) {
   mPasswordView.post(mClearPatternRunnable);
   if (TextUtils.isEmpty(password)) {
     password = LockPatternUtils.patternToString(pattern);
     mTVDrawPattern.setText(R.string.try_again);
   } else if (TextUtils.equals(password, LockPatternUtils.patternToString(pattern))) {
     mBtnDone.setEnabled(true);
   } else {
     mTVDrawPattern.setText(R.string.password_not_equal);
     YoYo.with(Techniques.Shake).duration(1000).playOn(mTVDrawPattern);
   }
 }
  private void initUI() {
    ImageView ivBackground = (ImageView) mRootLayout.findViewById(R.id.iv_background);
    WallpaperUtils.showWallpaper(getActivity(), ivBackground, mDao.getCurrent());

    mPasswordView = (LockCPicturePatternView) mRootLayout.findViewById(R.id.lpv_lockview);
    mPasswordView.setOnPatternListener(this);

    mTVDrawPattern = (TextView) mRootLayout.findViewById(R.id.tv_draw_pattern);

    mBtnCancel = (TextView) mRootLayout.findViewById(R.id.btn_reset);
    mBtnDone = (TextView) mRootLayout.findViewById(R.id.btn_done);
    mBtnCancel.setOnClickListener(this);
    mBtnDone.setOnClickListener(this);
    mBtnDone.setEnabled(false);
  }
 @Override
 public void onPatternCleared() {
   mPasswordView.removeCallbacks(mClearPatternRunnable);
 }
 public void run() {
   mPasswordView.clearPattern();
 }