示例#1
0
 @Override
 public void initView() {
   userName = SharedPreferenceUtil.getUserInfo("user_name", this);
   userPassword = SharedPreferenceUtil.getUserInfo("user_password", this);
   user_name.setText(userName);
   user_pw.setText(userPassword);
   SystemValue.deviceId = SharedPreferenceUtil.getUserInfo(SysValue.KEY_CAMERA_ID, this);
   SystemValue.devicePass = SharedPreferenceUtil.getUserInfo(SysValue.KEY_CAMERA_PWD, this);
   SystemValue.deviceName = SharedPreferenceUtil.getUserInfo(SysValue.KEY_CAMERA_USER, this);
 }
示例#2
0
  private void login() {
    userName = CommonUtils.getContentFromEditText(user_name);
    userPassword = CommonUtils.getContentFromEditText(user_pw);
    if (userName.equals("")) {
      ToastTool.showText(LoginAtivity.this, "请输入用户名");

      return;
    }
    if (userPassword.equals("")) {
      ToastTool.showText(LoginAtivity.this, "请输入密码");
      return;
    }
    if (!MatchTool.match(MatchTool.PWD, userPassword)) {
      ToastTool.showText(LoginAtivity.this, "请输入6-16位只包含汉字、字母、数字和特殊字符的密码");
      return;
    }
    LogTool.i("登陆请求:");
    Bundle param = new Bundle();
    param.putString("user", userName);
    param.putString("pwd", userPassword);
    reqData("/data/chklogin.json", param);
    String name = SharedPreferenceUtil.getUserInfo("user_name", this);
    // 清楚本地图片
    if (!name.equals(userName)) {
      LogTool.i("新用户登录");
      utils.deleteBtmap();
    }
  }