Search in sources :

Example 6 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class KDGerenZhuceActivity method dealResult.

// 加入成功后处理当前页面
private void dealResult() {
    List<BmobQuery<MyUser>> queries = new ArrayList<BmobQuery<MyUser>>();
    BmobQuery<MyUser> q1 = new BmobQuery<MyUser>();
    q1.addQueryKeys("teamFlag");
    BmobUser user = MyUser.getCurrentUser();
    String username = user.getUsername();
    BmobQuery<MyUser> q2 = new BmobQuery<MyUser>();
    q2.addWhereEqualTo("username", username);
    queries.add(q1);
    queries.add(q2);
    BmobQuery<MyUser> query = new BmobQuery<MyUser>();
    query.and(queries);
    query.findObjects(new FindListener<MyUser>() {

        @Override
        public void done(List<MyUser> object, BmobException e) {
            if (e == null) {
                MyUser u = object.get(0);
                if (!u.getTeamFlag().equals("")) {
                    setET(u.getMobilePhoneNumber(), u.getEmail(), u.getRealName(), u.getIdCard());
                }
            } else {
                L.i("error dealResult" + e.getMessage() + e.getErrorCode());
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobQuery(cn.bmob.v3.BmobQuery) BmobUser(cn.bmob.v3.BmobUser) ArrayList(java.util.ArrayList)

Example 7 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class MyInfoFragment method uploadImageHead.

// 上传图片到bmob
private void uploadImageHead(String bmString) {
    BitmapDrawable bitmap = (BitmapDrawable) getResources().getDrawable(R.drawable.add_pic);
    String addPicImgString = UtilTools.bitmapToString(getActivity(), bitmap);
    if (!bmString.equals(addPicImgString)) {
        MyUser newUser = new MyUser();
        newUser.setImgHead(bmString);
        BmobUser bmobUser = MyUser.getCurrentUser();
        newUser.update(bmobUser.getObjectId(), new UpdateListener() {

            @Override
            public void done(BmobException e) {
                if (e == null) {
                    L.i("上传头像成功");
                } else {
                    L.i("上传头像失败" + e);
                }
            }
        });
    }
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) BitmapDrawable(android.graphics.drawable.BitmapDrawable) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 8 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class RegiestActivity method registFromBmob.

/**
 * 注册到 bmob云端
 *
 * @param username
 * @param password
 */
private void registFromBmob(final String username, final String password) {
    MyUser myUser = new MyUser();
    myUser.setUsername(username);
    myUser.setPassword(password);
    // 注意:不能用save方法进行注册
    myUser.signUp(new SaveListener<MyUser>() {

        @Override
        public void done(MyUser s, BmobException e) {
            dialog.dismiss();
            if (e == null) {
                Toast.makeText(RegiestActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent();
                intent.putExtra("username", username);
                intent.putExtra("password", password);
                setResult(RESULT_OK, intent);
                finish();
            } else {
                Toast.makeText(RegiestActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) Intent(android.content.Intent)

Example 9 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class KDTeamRegister method regiestTeam.

private void regiestTeam() {
    String team_phone = et_team_teleohone.getText().toString().trim();
    String team_mail = et_team_mail.getText().toString().trim();
    String tname = et_tname.getText().toString().trim();
    if (!TextUtils.isEmpty(team_phone) && !TextUtils.isEmpty(team_mail) && !TextUtils.isEmpty(tname)) {
        if (UtilTools.checkMobileNumber(team_phone) && UtilTools.checkEmail(team_mail)) {
            MyUser u = new MyUser();
            u.setMobilePhoneNumber(team_phone);
            u.setEmail(team_mail);
            u.setTeamFlag(tname);
            BmobUser bmobUser = MyUser.getCurrentUser();
            u.update(bmobUser.getObjectId(), new UpdateListener() {

                @Override
                public void done(BmobException e) {
                    if (e == null) {
                        Toast.makeText(KDTeamRegister.this, "注册成功", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(KDTeamRegister.this, e.getMessage(), Toast.LENGTH_SHORT).show();
                        L.i(e.getMessage() + e.getErrorCode());
                    }
                }
            });
        } else {
            if (!UtilTools.checkMobileNumber(team_phone)) {
                Toast.makeText(KDTeamRegister.this, "电话格式不正确", Toast.LENGTH_SHORT).show();
            } else if (!UtilTools.checkEmail(team_mail)) {
                Toast.makeText(KDTeamRegister.this, "邮箱格式不正确", Toast.LENGTH_SHORT).show();
            }
        }
    } else {
        Toast.makeText(KDTeamRegister.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 10 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class UMyInfomationActivity method setDataTOView.

// 设置数据到界面上
private void setDataTOView() {
    // 获取缓存用户
    BmobUser userQuery = MyUser.getCurrentUser();
    // 获取缓存用户的用户名
    String cacheUsername = userQuery.getUsername();
    // 开始查询用户资料
    BmobQuery<MyUser> query = new BmobQuery<MyUser>();
    query.addWhereEqualTo("username", cacheUsername);
    query.findObjects(new FindListener<MyUser>() {

        @Override
        public void done(List<MyUser> object, BmobException e) {
            if (e == null) {
                MyUser user = object.get(0);
                String nichen = user.getUsername();
                String phoneNumber = user.getMobilePhoneNumber();
                String email = user.getEmail();
                String idCard = user.getIdCard();
                String realName = user.getRealName();
                // 查询成功后将数据设置到EditText上
                et_nichen.setText(nichen);
                et_mail.setText(email);
                et_idCard.setText(idCard);
                et_phoneNumber.setText(phoneNumber);
                et_real_name.setText(realName);
            } 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) BmobQuery(cn.bmob.v3.BmobQuery)

Aggregations

BmobException (cn.bmob.v3.exception.BmobException)10 MyUser (com.yuxuan.admin.expression.entity.MyUser)10 BmobUser (cn.bmob.v3.BmobUser)7 UpdateListener (cn.bmob.v3.listener.UpdateListener)5 BmobQuery (cn.bmob.v3.BmobQuery)3 Intent (android.content.Intent)2 ArrayList (java.util.ArrayList)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 FindListener (cn.bmob.v3.listener.FindListener)1 MyOrdersData (com.yuxuan.admin.expression.entity.MyOrdersData)1 UserDqInfomation (com.yuxuan.admin.expression.entity.UserDqInfomation)1 List (java.util.List)1