示例#1
0
    @Override
    public void onPatternDetected(List<Cell> pattern) {
      LogUtil.d(GestureLockActivity.this, "onPatternDetected");
      if (pattern.size() < LockPatternView.MIN_LOCK_PATTERN_SIZE) {
        mPromptTV.setTextColor(Color.RED);
        mPromptTV.setText(R.string.lockpattern_recording_incorrect_too_short);
        mLockPatternView.setDisplayMode(DisplayMode.Wrong);
        mLockPatternView.disableInput();
        mHandler.sendEmptyMessageDelayed(0, 1000);
        mIsGestureRight = false;
        return;
      }

      int result = mLockUtil.checkPattern(pattern);
      if (result == -1) {
        LogUtil.w(GestureLockActivity.this, "手势识别理解有错,请修改");
      }

      if (result == 1) {
        mIsGestureRight = true;
        mPromptTV.setTextColor(Color.BLACK);
        mPromptTV.setText("密码正确");
        new PreferenceUtil(GestureLockActivity.this, Constants.PREFERENCE_FILE)
            .setShouldShowCommission(true);
        sendRefreshComRecevier();
      } else {
        mIsGestureRight = false;
        mPromptTV.setTextColor(Color.RED);
        mPromptTV.setText("密码有误,请再次输入");
        mLockPatternView.setDisplayMode(DisplayMode.Wrong);
      }

      mLockPatternView.disableInput(); // 禁止输入,在手势消失后会重新enableInput
      mHandler.sendEmptyMessageDelayed(0, 1000);
    }
示例#2
0
    @Override
    public void onClick(View v) {
      switch (v.getId()) {
        case R.id.left_btn:
          finish();
          break;
        case R.id.right_btn:
          UserInfo userInfo = ZCApplication.getInstance().getUserInfo();
          if (userInfo == null) {
            Toaster.showShort(GestureLockActivity.this, "请先登录");
            return;
          }

          final EditText passwordET = new EditText(GestureLockActivity.this);
          new AlertDialog.Builder(GestureLockActivity.this)
              .setTitle("验证登录密码")
              .setView(passwordET)
              .setPositiveButton(
                  "确定",
                  new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      isPasswordRight(StringUtils.getText(passwordET));
                    }
                  })
              .setNegativeButton("取消 ", null)
              .show();
          break;
        default:
          LogUtil.w(GestureLockActivity.this, "点击了未知的按钮");
      }
    }
示例#3
0
 private void pushDepOnType(AcademyContent content, String typeCode) {
   if (TYPE_NORMAL.equals(typeCode)) {
     push(AcademyKnowledgeActivity.class, content);
   } else if (TYPE_FAQ.equals(typeCode)) {
     push(AcademyFAQActivity.class, content);
   } else {
     LogUtil.w(AcademyActivity.this, "点击了未知组的选项");
   }
 }
示例#4
0
 @Override
 public void onHttpSuccess(String path, String result) {
   super.onHttpSuccess(path, result);
   if (TextUtils.isEmpty(result)) {
     Toaster.showShort(this, "服务器出错了,请重试");
     LogUtil.e(this, "网络返回的数据为空");
     return;
   }
   dealWithHttpReturned(result);
 }