示例#1
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, "点击了未知的按钮");
      }
    }
示例#2
0
  private boolean isPasswordRight(String password) {
    if (TextUtils.isEmpty(password)) {
      Toaster.showShort(GestureLockActivity.this, "密码不能为空");
      return false;
    }

    if (!InputFormatChecker.isPasswordEligible(password)) {
      Toaster.showShort(GestureLockActivity.this, "密码格式不正确");
      return false;
    }

    HttpRequest.doVerfiyPwd(
        this, ZCApplication.getInstance().getUserInfo().getPhone(), password, this);
    return false;
  }