Search in sources :

Example 11 with UpdateListener

use of cn.bmob.v3.listener.UpdateListener in project expression by happy-yuxuan.

the class UIdentifyPhoneActivity method submitVerify.

// 提交验证
private void submitVerify(final String mobileNumber, String identify_code) {
    L.i("开始验证手机");
    BmobSMS.verifySmsCode(mobileNumber, identify_code, new UpdateListener() {

        @Override
        public void done(BmobException ex) {
            if (ex == null) {
                // 短信验证码已验证成功
                L.i("smile 验证通过 开始绑定");
                // 验证手机成功,绑定用户
                bindMobilePhone(mobileNumber);
            } else {
                L.i("smile 验证失败:code =" + ex.getErrorCode() + ",msg = " + ex.getLocalizedMessage());
            }
        }
    });
}
Also used : BmobException(cn.bmob.v3.exception.BmobException) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 12 with UpdateListener

use of cn.bmob.v3.listener.UpdateListener in project expression by happy-yuxuan.

the class UMyInfomationActivity method updataUser.

/**
 * 修改User表,主要修改username, real_name, phone, email, idCard 字段
 */
private void updataUser() {
    String username = et_nichen.getText().toString().trim();
    String real_name = et_real_name.getText().toString().trim();
    String phoneNumber = et_phoneNumber.getText().toString().trim();
    String idCard = et_idCard.getText().toString().trim();
    String email = et_mail.getText().toString().trim();
    // 获取缓存用户的信息
    final String cacheUsername = BmobUser.getCurrentUser().getUsername();
    BmobUser cachebUser = BmobUser.getCurrentUser();
    MyUser newUser = new MyUser();
    if (!email.equals(cachebUser.getEmail())) {
        newUser.setEmail(email);
    }
    if (!username.equals(cachebUser.getUsername())) {
        newUser.setUsername(username);
    }
    if (!phoneNumber.equals(cachebUser.getMobilePhoneNumber())) {
        newUser.setMobilePhoneNumber(phoneNumber);
    }
    newUser.setRealName(real_name);
    newUser.setIdCard(idCard);
    newUser.update(cachebUser.getObjectId(), new UpdateListener() {

        @Override
        public void done(BmobException e) {
            dialog.dismiss();
            if (e == null) {
                Toast.makeText(UMyInfomationActivity.this, "修改资料成功", Toast.LENGTH_SHORT).show();
                // 更新UserDqInfomation表(cacheUsername 是修改关键字)
                updataUserDqInfomation(cacheUsername);
                // 设置 EditText 为 未激活状态
                setEditTextEnable(false);
            } else {
                Toast.makeText(UMyInfomationActivity.this, "修改失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 13 with UpdateListener

use of cn.bmob.v3.listener.UpdateListener in project expression by happy-yuxuan.

the class UMyOrdersActivity method dealResult.

private void dealResult() {
    L.i("da_phone = " + tv_phone.getText().toString());
    L.i("addr = " + tv_addr.getText().toString());
    List<BmobQuery<UserDqInfomation>> queries = new ArrayList<BmobQuery<UserDqInfomation>>();
    BmobQuery<UserDqInfomation> q1 = new BmobQuery<UserDqInfomation>();
    q1.addWhereEqualTo("dq_phone", tv_phone.getText().toString());
    BmobQuery<UserDqInfomation> q2 = new BmobQuery<UserDqInfomation>();
    q2.addWhereEqualTo("addr", tv_addr.getText().toString());
    BmobQuery<UserDqInfomation> q3 = new BmobQuery<UserDqInfomation>();
    BmobUser user = MyUser.getCurrentUser();
    String username = user.getUsername();
    q3.addWhereEqualTo("username", username);
    queries.add(q1);
    queries.add(q2);
    queries.add(q3);
    // 找到objId
    BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
    query.and(queries);
    // 执行查询方法 获得 objId
    query.findObjects(new FindListener<UserDqInfomation>() {

        @Override
        public void done(List<UserDqInfomation> object, BmobException e) {
            if (e == null) {
                UserDqInfomation udi = new UserDqInfomation();
                udi.setSuccess(true);
                // 执行更新方法
                udi.update(object.get(0).getObjectId(), new UpdateListener() {

                    @Override
                    public void done(BmobException e) {
                        if (e == null) {
                            L.i(" success 更新成功");
                            displayList.dismiss();
                            queryData();
                            Toast.makeText(UMyOrdersActivity.this, "代取成功,我们将一直为您服务", Toast.LENGTH_SHORT).show();
                        } else {
                            L.i("bmob 更新失败:" + e.getMessage() + "," + e.getErrorCode());
                            Toast.makeText(UMyOrdersActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    }
                });
            } else {
                L.i("query dq_phone at UMyOrderActivity 失败:" + e.getMessage() + "," + e.getErrorCode());
                Toast.makeText(UMyOrdersActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : BmobException(cn.bmob.v3.exception.BmobException) UserDqInfomation(com.yuxuan.admin.expression.entity.UserDqInfomation) BmobQuery(cn.bmob.v3.BmobQuery) BmobUser(cn.bmob.v3.BmobUser) ArrayList(java.util.ArrayList) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 14 with UpdateListener

use of cn.bmob.v3.listener.UpdateListener in project expression by happy-yuxuan.

the class KDGerenZhuceActivity method regiestPerson.

private void regiestPerson() {
    String phoneNumber = et_phoneNumber.getText().toString().trim();
    String email = et_mail.getText().toString().trim();
    String realName = et_real_name.getText().toString().trim();
    String idCard = et_idcard.getText().toString().trim();
    if (UtilTools.checkMobileNumber(phoneNumber) && !TextUtils.isEmpty(realName) && !TextUtils.isEmpty(idCard) && UtilTools.checkEmail(email)) {
        // 更新
        MyUser newUser = new MyUser();
        newUser.setEmail(email);
        newUser.setMobilePhoneNumber(phoneNumber);
        newUser.setRealName(realName);
        newUser.setIdCard(idCard);
        newUser.setTeamFlag("1");
        BmobUser bmobUser = MyUser.getCurrentUser();
        newUser.update(bmobUser.getObjectId(), new UpdateListener() {

            @Override
            public void done(BmobException e) {
                if (e == null) {
                    Toast.makeText(KDGerenZhuceActivity.this, "加入成功", Toast.LENGTH_SHORT).show();
                    dealResult();
                } else {
                    Toast.makeText(KDGerenZhuceActivity.this, "加入失败" + e, Toast.LENGTH_SHORT).show();
                    L.d(e.getErrorCode() + "");
                }
            }
        });
    } else {
        if (!UtilTools.checkMobileNumber(phoneNumber)) {
            Toast.makeText(this, "电话输入格式不正确", Toast.LENGTH_SHORT).show();
        } else if (!UtilTools.checkEmail(email)) {
            Toast.makeText(this, "邮箱格式不正确", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "信息填写不完整", Toast.LENGTH_SHORT).show();
        }
    }
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 15 with UpdateListener

use of cn.bmob.v3.listener.UpdateListener in project SmartCampus by Vegen.

the class SignUpPresenter method signUpServer.

@Override
public void signUpServer(String phone, String password, String sex, String schoolName, Integer schoolId) {
    // SmartUser smartUser = new SmartUser();
    // smartUser.setPhone(phone);
    // smartUser.setPassword(password);
    // smartUser.setSex(sex);
    // smartUser.setSchoolName(schoolName);
    // smartUser.setSchoolId(schoolId);
    // smartUser.save(new SaveListener<String>() {
    // @Override
    // public void done(String s, BmobException e) {
    // if (e == null) {
    // if (mView != null) mView.hideLoading(false);
    // } else {
    // if (mView != null) {
    // mView.showMessage(e.getMessage());
    // mView.hideLoading(true);
    // }
    // }
    // }
    // });
    BmobUser bmobUser = new BmobUser();
    bmobUser.setUsername(phone);
    bmobUser.setPassword(password);
    bmobUser.signUp(new SaveListener<SmartUser>() {

        @Override
        public void done(SmartUser s, BmobException e) {
            if (e == null) {
                SmartUser newUser = new SmartUser();
                newUser.setSex(sex);
                newUser.setSchoolId(schoolId);
                newUser.setSchoolName(schoolName);
                SmartUser bmobUser = BmobUser.getCurrentUser(SmartUser.class);
                if (bmobUser != null) {
                    newUser.update(bmobUser.getObjectId(), new UpdateListener() {

                        @Override
                        public void done(BmobException e) {
                            if (e == null) {
                                if (mView != null)
                                    mView.hideLoading(false);
                            } else {
                                if (mView != null) {
                                    mView.showMessage(e.getMessage());
                                    mView.hideLoading(true);
                                }
                            }
                        }
                    });
                } else {
                    if (mView != null) {
                        mView.showMessage(e.getMessage());
                        mView.hideLoading(true);
                    }
                }
            } else {
                if (mView != null) {
                    mView.showMessage(e.getMessage());
                    mView.hideLoading(true);
                }
            }
        }
    });
}
Also used : BmobException(cn.bmob.v3.exception.BmobException) SmartUser(com.itculturalfestival.smartcampus.entity.db.SmartUser) BmobUser(cn.bmob.v3.BmobUser) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Aggregations

UpdateListener (cn.bmob.v3.listener.UpdateListener)17 BmobUser (cn.bmob.v3.BmobUser)15 BmobException (cn.bmob.v3.exception.BmobException)9 User (com.nightonke.saver.model.User)7 MyUser (com.yuxuan.admin.expression.entity.MyUser)5 Handler (android.os.Handler)3 SaveListener (cn.bmob.v3.listener.SaveListener)3 NonNull (android.support.annotation.NonNull)2 BmobQuery (cn.bmob.v3.BmobQuery)2 BmobFile (cn.bmob.v3.datatype.BmobFile)2 DialogAction (com.afollestad.materialdialogs.DialogAction)2 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)2 File (java.io.File)2 DialogInterface (android.content.DialogInterface)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 AlertDialog (android.support.v7.app.AlertDialog)1 EditText (android.widget.EditText)1 LinearLayout (android.widget.LinearLayout)1 OnClick (butterknife.OnClick)1 DeleteListener (cn.bmob.v3.listener.DeleteListener)1