예제 #1
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;
  }
예제 #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 dealWithHttpReturned(String result) {
   Gson gson = new Gson();
   HttpResult r = gson.fromJson(result, HttpResult.class);
   String responseCode = r.getResult().getErrorcode();
   if (HttpResult.SUCCESS.equals(responseCode)) {
     LockPatternUtils util = new LockPatternUtils(this);
     util.clearLock();
     Toaster.showShort(this, "请重新设置密码");
     ContextUtil.pushToActivity(this, GestureLockSettingActivity.class);
     finish();
   } else if (HttpResult.FAIL.equals(responseCode)) {
     Toaster.showShort(this, r.getResult().getErrormsg());
   } else {
     Toaster.showShort(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);
 }
예제 #5
0
 private void dealWithHttpReturned(String result) {
   Gson gson = new Gson();
   AcademyResult r = gson.fromJson(result, AcademyResult.class);
   String resultCode = r.getResult().getErrorcode();
   if (HttpResult.SUCCESS.equals(resultCode)) {
     List<AcademyClass> academyClasses = r.getAcademys();
     mItems.addAll(academyClasses);
     mAdapter.notifyDataSetChanged();
   } else if (HttpResult.FAIL.equals(resultCode)) {
   } else {
     Toaster.showShort(AcademyActivity.this, "请求出错,请重试");
   }
 }