コード例 #1
0
  private void complete() {
    if (imgPath.equals("") || imgPath == null) {
      avatar = Account.getUserInfo().getUserAvatar();
      submit();
    } else {
      QiniuManager.getInstance()
          .uploadFile(
              this,
              imgPath,
              "img",
              new QiniuRequestCallbBack() {

                @Override
                public void OnFailed(String msg) {
                  // TODO Auto-generated method stub
                  ToastUtil.show(EditInfoActivity.this, msg);
                }

                @Override
                public void OnComplate(String key) {
                  // TODO Auto-generated method stub
                  avatar = C.API.QINIU_BASE_URL + key;
                  submit();
                }
              });
    }
  }
コード例 #2
0
  private void submit() {
    String nickname = editNickname.getText().toString().trim();
    String tmpSex = editSex.getText().toString().trim();
    String area = editArea.getText().toString().trim();
    String birthday = editBirthday.getText().toString().trim();
    String signature = editSignature.getText().toString().trim();
    int sex = 0;
    if (tmpSex.equals("男")) {
      sex = 1;
    } else {
      sex = 0;
    }

    RequestParams params = new RequestParams();
    params.put("userId", Account.getUserInfo().getUserId());
    params.put("nickName", nickname);
    params.put("userAvatar", avatar);
    params.put("sex", sex);
    params.put("userArea", area);
    params.put("birthday", birthday);
    params.put("signature", signature);
    ApiManager.getInstance()
        .post(
            this,
            C.API.UPDATE_USER_INFO,
            params,
            new HttpCallBack() {

              @Override
              public void onSuccess(Object res) {
                // TODO Auto-generated method stub
                @SuppressWarnings("unchecked")
                List<User> list = (List<User>) res;
                User user = list.get(0);
                Account.saveUserInfo(user);

                setResult(RESULT_OK);
                finish();
              }

              @Override
              public void onFailure(Object res) {
                // TODO Auto-generated method stub
                ToastUtil.show(EditInfoActivity.this, (String) res);
              }
            },
            "User");
  }
コード例 #3
0
 private void initUser() {
   User spUser = Account.getUserInfo();
   ImageLoader.getInstance()
       .displayImage(spUser.getUserAvatar(), editAvatar, getDisplayImageOptions());
   editNickname.setText(spUser.getNickName());
   if (spUser.getSex() == 0) {
     editSex.setText("女");
   } else {
     editSex.setText("男");
   }
   if (spUser.getUserArea() == null || spUser.getUserArea().equals("")) {
     editArea.setText("北京市 北京市");
   } else {
     editArea.setText(spUser.getUserArea());
   }
   if (spUser.getBirthday() == null || spUser.getBirthday().equals("")) {
     editBirthday.setText("2000-01-01");
   } else {
     editBirthday.setText(spUser.getBirthday());
   }
   if (spUser.getSignature() != null && !spUser.getSignature().equals("")) {
     editSignature.setText(spUser.getSignature());
   }
 }