cn.bmob.v3.listener.UpdateListener Java Examples
The following examples show how to use
cn.bmob.v3.listener.UpdateListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrderManagerPresenter.java From BitkyShop with MIT License | 6 votes |
/** * 在服务器中更新订单状态 * * @param orderOrigin 当前本地订单条目 * @param updateStatus 欲更新到的状态 */ public void updateOrderStatus(Order orderOrigin, final int updateStatus) { Order order = new Order(); order.setObjectId(orderOrigin.getObjectId()); order.setStatus(updateStatus); order.update(new UpdateListener() { @Override public void done(BmobException e) { if (e != null) { activity.showMessage(e.getMessage()); } else { switch (updateStatus) { case Order.COMPLETED: activity.showMessage("确认收货成功"); break; case Order.CANCELLED: activity.showMessage("该订单已被取消"); break; } if (userObjectId != null) queryOrderFormBmob(userObjectId, status); } } }); }
Example #2
Source File: BmobCourseDataSource.java From ZfsoftCampusAssit with Apache License 2.0 | 6 votes |
@Override public void updateTimetableCourse(Course course) { if (course != null && mContext != null) { course.update(mContext, course.getObjectId() , new UpdateListener() { @Override public void onSuccess() { Log.d(tag,"bmob timetable course updated successful."); } @Override public void onFailure(int i, String s) { Log.e(tag,"bmob timetable course updated failure."); } }); } else { Log.e(tag,"bmob update cannot null"); } }
Example #3
Source File: GroupInfoPresenter.java From NewFastFrame with Apache License 2.0 | 6 votes |
public void exitGroup(String groupId,String uid) { iView.showLoading("正在退群中 。。。。。。。。。"); MsgManager.getInstance().exitGroup(groupId,uid,new UpdateListener() { @Override public void done(BmobException e) { iView.hideLoading(); if (e == null) { ToastUtils.showShortToast("退群成功"); RxBusManager .getInstance() .post(new GroupTableEvent(groupId,GroupTableEvent.TYPE_GROUP_NUMBER ,GroupTableEvent.ACTION_DELETE,uid)); iView.updateData(groupId); }else { ToastUtils.showShortToast("退群失败"); } } }); iView.showLoading("正在退群中.........."); }
Example #4
Source File: BmobDataHelper.java From Swface with Apache License 2.0 | 6 votes |
public void deleteUserFace(final String object, final String faceToken, final String faceUrl){ UserHasSigned userHasSigned = new UserHasSigned(context); userHasSigned.setObjectId(object); userHasSigned.remove(faceToken); userHasSigned.remove(faceUrl); userHasSigned.update(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ DatabaseAdapter db = new DatabaseAdapter(context); db.deleteUserFace_User(object,faceToken,faceUrl,myHandler); }else{ Log.e(TAG, "deleteUserFace: ", e); Message message = Message.obtain(); message.arg1 = FinalUtil.REMOVE_FACE_BMOB_EXCEPTION; myHandler.sendMessage(message); } } }); }
Example #5
Source File: WallPaperActivity.java From NewFastFrame with Apache License 2.0 | 6 votes |
private void initActionBar() { ToolBarOption toolBarOption = new ToolBarOption(); toolBarOption.setRightText("完成"); toolBarOption.setTitle("选择背景图片"); toolBarOption.setAvatar(UserManager.getInstance().getCurrentUser().getAvatar()); toolBarOption.setNeedNavigation(true); toolBarOption.setRightListener(v -> { if (selectedImage != null && !selectedImage.equals(UserManager.getInstance().getCurrentUser() .getTitleWallPaper())) { UserManager.getInstance().updateUserInfo(from, selectedImage, new UpdateListener() { @Override public void done(BmobException e) { if (e == null) { RxBusManager.getInstance().post(UserManager.getInstance().cover(UserManager.getInstance().getCurrentUser())); } else { LogUtil.e("上传背景图片到服务器上失败" + e.toString()); } finish(); } }); } }); setToolBar(toolBarOption); }
Example #6
Source File: SignupActivity.java From BitkyShop with MIT License | 6 votes |
/** * 注册成功调用 */ private void signUpSuccessful(final KyUser kyUser) { KyUser newKyUser = new KyUser(); newKyUser.setHaveDetailInfo(true); newKyUser.update(kyUser.getObjectId(), new UpdateListener() { @Override public void done(BmobException e) { Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putString("objectId", kyUser.getObjectId()); bundle.putString("username", kyUser.getUsername()); bundle.putString("password", inputPwdStr); intent.putExtra("bundle", bundle); setResult(KySet.USER_RESULT_SIGN_UP, intent); finish(); } }); }
Example #7
Source File: UserDataUtils.java From Conquer with Apache License 2.0 | 6 votes |
/** * 保存用户信息 * * @param context * @param user */ public static void UpdateUserData(Context context, User user, boolean hasDialog, final UpdateUserDataListener updateListener) { if (hasDialog){ ProgressUtil.showWaitting(context); } user.update(context.getApplicationContext(), new UpdateListener() { @Override public void onSuccess() { L.i("更新用户信息成功"); updateListener.onSuccess(); ProgressUtil.dismiss(); } @Override public void onFailure(int arg0, String arg1) { L.i("更新用户信息失败:" + arg0 + arg1); updateListener.onFailure(arg0, arg1); ProgressUtil.dismiss(); } }); }
Example #8
Source File: UserDataUtils.java From Conquer with Apache License 2.0 | 6 votes |
/** * 保存用户信息 * @param context * @param user */ public static void UpdateUserData(Context context, User user, final UpdateUserDataListener updateListener) { user.update(context.getApplicationContext(), new UpdateListener() { @Override public void onSuccess() { L.i("更新用户信息成功"); updateListener.onSuccess(); } @Override public void onFailure(int arg0, String arg1) { L.i("更新用户信息失败:" + arg0 + arg1); updateListener.onFailure(arg0, arg1); } }); }
Example #9
Source File: BlackListActivity.java From Conquer with Apache License 2.0 | 6 votes |
/** * 显示移除黑名单对话框 * @Title: showRemoveBlackDialog * @Description: TODO * @param @param position * @param @param invite * @return void * @throws */ public void showRemoveBlackDialog(final int position, final BmobChatUser user) { new Builder(context).setTitle("移除黑名单").setMessage("确实移出黑名单吗?").setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { adapter.remove(position); userManager.removeBlack(user.getUsername(), new UpdateListener() { @Override public void onSuccess() { T.show(context, "移出黑名单成功"); // 重新设置下内存中保存的好友列表 CustomApplication.getInstance().setContactList( CollectionUtils.list2map(BmobDB.create(getApplicationContext()).getContactList())); } @Override public void onFailure(int arg0, String arg1) { T.show(context, "移出黑名单失败:" + arg1); } }); } }).setNegativeButton("取消", null).show(); }
Example #10
Source File: MyPhotoActivity.java From Conquer with Apache License 2.0 | 6 votes |
/** * 更新相册 */ public void updateAlbum() { // 更新 if (currentUser != null) { currentUser.setAlbum(list); currentUser.update(context, new UpdateListener() { @Override public void onSuccess() { L.d("更新相册成功" + list.size()); } @Override public void onFailure(int arg0, String arg1) { L.d("更新相册失败"); } }); } }
Example #11
Source File: MsgManager.java From NewFastFrame with Apache License 2.0 | 6 votes |
public void updateGroupMessage(final String groupId, final String name, final String content, final UpdateListener listener) { GroupTableMessage groupTableMessage = new GroupTableMessage(); groupTableMessage.setObjectId(groupId); switch (name) { case ConstantUtil.GROUP_AVATAR: groupTableMessage.setGroupAvatar(content); break; case ConstantUtil.GROUP_NOTIFICATION: groupTableMessage.setNotification(content); break; case ConstantUtil.GROUP_DESCRIPTION: groupTableMessage.setGroupDescription(content); break; case ConstantUtil.GROUP_NAME: groupTableMessage.setGroupName(content); break; case ConstantUtil.GROUP_REMIND: groupTableMessage.setRemind(Boolean.parseBoolean(content)); break; default: break; } groupTableMessage.update(listener); }
Example #12
Source File: UserManager.java From NewFastFrame with Apache License 2.0 | 6 votes |
/** * 在服务器上关联该好友 * * @param user 用户实体 * @param currentId 现在的登录用户ID * @param updateListener 跟新回调 */ private void saveNewFriendToServer(User user, String currentId, UpdateListener updateListener) { if (getCurrentUser() != null && currentId.equals(getCurrentUserObjectId())) { User currentUser = new User(); currentUser.setObjectId(currentId); BmobRelation relation = new BmobRelation(); relation.add(user); currentUser.setContacts(relation); currentUser.update(updateListener ); } else { LogUtil.e("toId:" + currentId); if (getCurrentUser() != null) { LogUtil.e("现在的UID:" + getCurrentUserObjectId()); } // 不是当前用户的情况下 LogUtil.e("不是当前的用户,不在服务器上关联该好友"); updateListener.done(new BmobException(0, "不是当前的用户,不在服务器上关联该好友")); } }
Example #13
Source File: OrderActivityPresenter.java From BitkyShop with MIT License | 6 votes |
/** * 在服务器中更新订单状态 * * @param orderOrigin 当前本地订单条目 * @param updateStatus 欲更新到的状态 */ public void updateOrderStatus(final Order orderOrigin, final int updateStatus) { Order order = new Order(); order.setObjectId(orderOrigin.getObjectId()); order.setStatus(updateStatus); order.update(new UpdateListener() { @Override public void done(BmobException e) { if (e != null) { activity.showMessage(e.getMessage()); } else { switch (updateStatus) { case Order.COMPLETED: activity.showMessage("确认收货成功"); break; case Order.CANCELLED: activity.showMessage("该订单已被取消"); break; } orderOrigin.setStatus(updateStatus); activity.changeOrderStatus(orderOrigin); } } }); }
Example #14
Source File: BmobDataHelper.java From Swface with Apache License 2.0 | 6 votes |
public void deleteUser(final String objectId){ UserHasSigned userHasSigned = new UserHasSigned(context); userHasSigned.setObjectId(objectId); userHasSigned.delete(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ DatabaseAdapter db = new DatabaseAdapter(context); db.deleteUser_User(objectId,myHandler); }else{ Log.e(TAG, "userHasSigned.delete: ", e); Message message = Message.obtain(); message.arg1 = FinalUtil.REMOVE_USER_BMOB_EXCEPTION; myHandler.sendMessage(message); } } }); }
Example #15
Source File: UserManager.java From TestChat with Apache License 2.0 | 6 votes |
/** * 在服务器上关联该好友 * * @param user 用户实体 * @param currentId 现在的登录用户ID * @param updateListener 跟新回调 */ private void saveNewFriendToServer(User user, String currentId, UpdateListener updateListener) { if (getCurrentUser() != null && currentId.equals(getCurrentUserObjectId())) { User currentUser = new User(); currentUser.setObjectId(currentId); BmobRelation relation = new BmobRelation(); relation.add(user); currentUser.setContacts(relation); currentUser.update(CustomApplication.getInstance(), updateListener ); } else { LogUtil.e("toId:" + currentId); if (getCurrentUser() != null) { LogUtil.e("现在的UID:" + getCurrentUserObjectId()); } // 不是当前用户的情况下 LogUtil.e("不是当前的用户,不在服务器上关联该好友"); updateListener.onFailure(0, "不是当前的用户,不在服务器上关联该好友"); } }
Example #16
Source File: UserManager.java From TestChat with Apache License 2.0 | 6 votes |
/** * 添加为黑名单 * * @param user 用户实体 * @param addBlackCallBackListener 回调 */ public void addToBlack(final User user, final AddBlackCallBackListener addBlackCallBackListener) { addBlackRelation(user, new UpdateListener() { @Override public void onSuccess() { long result1 = updateFriendBlackStatus(user.getUsername(), true); long result2 = ChatDB.create().deleteRecentMsg(user.getObjectId()); if (result1 > 0 && result2 > 0) { addBlackCallBackListener.onSuccess(user); } else { addBlackCallBackListener.onFailed(new BmobException("在数据库更新用户黑名单状态失败或者是删除最近会话失败")); } // LogUtil.e("在服务器上关联该用户为黑名单失败"); } @Override public void onFailure(int i, String s) { LogUtil.e("在服务器上关联该用户为黑名单失败"); addBlackCallBackListener.onFailed(new BmobException(s)); } } ); }
Example #17
Source File: UserManager.java From TestChat with Apache License 2.0 | 6 votes |
/** * 取消黑名单回调 * * @param user 用户实体 * @param listener 回调 */ public void cancelBlack(final User user, final CancelBlackCallBlackListener listener) { deleteBlackRelation(user, new UpdateListener() { @Override public void onSuccess() { long result = updateFriendBlackStatus(user.getUsername(), false); if (result > 0) { listener.onSuccess(user); } else { listener.onFailed(new BmobException("在数据库中更新黑名单状态失败")); } } @Override public void onFailure(int i, String s) { listener.onFailed(new BmobException(s)); } } ); }
Example #18
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void addLiker(final String id, final DealMessageCallBack dealMessageCallBack) { final SharedMessage sharedMessage = ChatDB.create().getSharedMessage(id); sharedMessage.getLikerList().add(UserManager.getInstance().getCurrentUserObjectId()); sharedMessage.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { ChatDB.create().saveSharedMessage(sharedMessage); dealMessageCallBack.onSuccess(sharedMessage.getObjectId()); } @Override public void onFailure(int i, String s) { dealMessageCallBack.onFailed(sharedMessage.getObjectId(), i, s); } }); }
Example #19
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void deleteLiker(final String id, final DealMessageCallBack dealMessageCallBack) { final SharedMessage sharedMessage = ChatDB.create().getSharedMessage(id); if (sharedMessage.getLikerList().contains(UserManager.getInstance().getCurrentUserObjectId())) { sharedMessage.getLikerList().remove(UserManager.getInstance().getCurrentUserObjectId()); LogUtil.e("删除点赞消息成功"); } sharedMessage.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { LogUtil.e("更新服务器上删除点赞消息成功"); ChatDB.create().saveSharedMessage(sharedMessage); dealMessageCallBack.onSuccess(sharedMessage.getObjectId()); } @Override public void onFailure(int i, String s) { LogUtil.e("更新服务器上删除点赞消息失败"); dealMessageCallBack.onFailed(sharedMessage.getObjectId(), i, s); } }); }
Example #20
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void deleteComment(final String id, final int position, final DealCommentMsgCallBack dealCommentMsgCallBack) { // 这里先进行说说主题的解绑操作 final SharedMessage sharedMessage = ChatDB.create().getSharedMessage(id); if (sharedMessage.getCommentMsgList().size() > position) { final String commentMsg = sharedMessage.getCommentMsgList().remove(position); LogUtil.e("11将要删除的评论消息:" + commentMsg); sharedMessage.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { LogUtil.e("在服务器上更新删除评论成功"); ChatDB.create().saveSharedMessage(sharedMessage); dealCommentMsgCallBack.onSuccess(sharedMessage.getObjectId(), commentMsg, position); } @Override public void onFailure(int i, String s) { LogUtil.e("在服务器上更新删除评论失败" + s + i); dealCommentMsgCallBack.onFailed(sharedMessage.getObjectId(), commentMsg, position, i, s); } }); } }
Example #21
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void updateUserAvatar(final String uid, final String avatar, final DealUserInfoCallBack dealUserInfoCallBack) { User user = new User(); user.setObjectId(uid); user.setAvatar(avatar); user.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { LogUtil.e("在服务器上更新用户头像成功"); dealUserInfoCallBack.updateAvatarSuccess(uid, avatar); } @Override public void onFailure(int i, String s) { LogUtil.e("在服务器上更新用户头像失败"); dealUserInfoCallBack.onFailed(uid, i, s); } }); }
Example #22
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void updateUserSignature(final String uid, final String signature, final DealUserInfoCallBack dealUserInfoCallBack) { User user = new User(); user.setSignature(signature); user.setObjectId(uid); user.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { LogUtil.e("在服务器上更新用户签名成功"); dealUserInfoCallBack.updateSignatureSuccess(uid, signature); } @Override public void onFailure(int i, String s) { LogUtil.e("在服务器上更新用户签名失败"); dealUserInfoCallBack.onFailed(uid, i, s); } }); }
Example #23
Source File: MsgManager.java From TestChat with Apache License 2.0 | 6 votes |
public void updateUserNick(final String uid, final String nick, final DealUserInfoCallBack dealUserInfoCallBack) { User user = new User(); user.setNick(nick); user.setObjectId(uid); user.update(CustomApplication.getInstance(), new UpdateListener() { @Override public void onSuccess() { LogUtil.e("在服务器上更新用户昵称成功"); dealUserInfoCallBack.updateNickSuccess(uid, nick); } @Override public void onFailure(int i, String s) { LogUtil.e("在服务器上更新用户昵称失败"); dealUserInfoCallBack.onFailed(uid, i, s); } }); }
Example #24
Source File: ChangePasswordActivity.java From MyHearts with Apache License 2.0 | 6 votes |
@Override public void initData() { super.initData(); if (!TextUtils.isEmpty(objectId)){ newPassword = mClearEditText.getText().toString(); if (RegularUtils.isPassword(newPassword)){ MyUser user = new MyUser(); user.setPassword(newPassword); user.update(objectId, new UpdateListener() { @Override public void done(BmobException e) { if (e==null){ Toast.makeText(ChangePasswordActivity.this, getResources().getString(R.string.change_success), Toast.LENGTH_SHORT).show(); } } }); } else { } } }
Example #25
Source File: GroupNumberInfoDetailActivity.java From TestChat with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_group_number_info_detail_exit: if (!CommonUtils.isNetWorkAvailable()) { ToastUtils.showShortToast("网络连接失败,请检查网络配置"); return; } final String deleteId = mGroupNumberInfo.getUser().getObjectId(); MsgManager.getInstance().updateGroupMessage(groupId, "deleteNumber", deleteId, new UpdateListener() { @Override public void onSuccess() { LogUtil.e("1删除群成员成功"); } @Override public void onFailure(int i, String s) { LogUtil.e("删除群成员失败" + s + i); } }); break; } }
Example #26
Source File: MeEditorAreaAty.java From myapplication with Apache License 2.0 | 6 votes |
/** * 上传职业job信息 * * @param areaStr job名称 */ private void uploadAreaData(String areaStr) { AppUser newAppUser = new AppUser(); newAppUser.setUserArea(areaStr); AppUser currentAppUser = BmobUser.getCurrentUser(AppUser.class); newAppUser.update(currentAppUser.getObjectId(), new UpdateListener() { @Override public void done(BmobException e) { if (e == null) { Toast.makeText(MeEditorAreaAty.this, "修改成功, 数据已上传!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MeEditorAreaAty.this, "修改失败! " + e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); Intent intent1 = new Intent(); intent1.putExtra("MeEditorAreaAty.areaStr", areaStr); MeEditorAreaAty.this.setResult(RESULT_OK, intent1); }
Example #27
Source File: MeEditorJobAty.java From myapplication with Apache License 2.0 | 6 votes |
/** * 上传职业job信息 * * @param jobStr job名称 */ private void uploadJobData(final String jobStr) { AppUser newAppUser = new AppUser(); newAppUser.setUserJob(jobStr); AppUser currentAppUser = BmobUser.getCurrentUser(AppUser.class); newAppUser.update(currentAppUser.getObjectId(), new UpdateListener() { @Override public void done(BmobException e) { if (e == null) { Toast.makeText(MeEditorJobAty.this, "修改成功!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MeEditorJobAty.this, "修改失败! " + e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); Intent intent1 = new Intent(); intent1.putExtra("MeEditorJobAty.jobStr", jobStr); MeEditorJobAty.this.setResult(RESULT_OK, intent1); MeEditorJobAty.this.finish(); }
Example #28
Source File: RouteDetailActivity.java From Mobike with Apache License 2.0 | 6 votes |
private void add(Credit cr) { cr.update(new UpdateListener() { @Override public void done(BmobException e) { if (e==null){ }else { ToastUtils.show(RouteDetailActivity.this,"骑行记录保存失败"); Logger.d(e); mDialog.dismiss(); } } }); }
Example #29
Source File: RegisterOrResetActivity.java From Pigeon with MIT License | 6 votes |
/** * 重置密码 */ private void resetPassword() { if (isTel && isTruePassword) { dialog.showDialog(); BmobUser.resetPasswordBySMSCode(smsCodeString, rePassWordString, new UpdateListener() { @Override public void done(BmobException e) { if (e == null) { dialog.dismissDialog(); ToastUtils.showToast(RegisterOrResetActivity.this, "重置密码成功"); AppManager.getAppManager().finishActivity(); } else { dialog.dismissDialog(); ToastUtils.showToast(RegisterOrResetActivity.this, e.getMessage()); } } }); } else { dialog.dismissDialog(); ToastUtils.showToast(RegisterOrResetActivity.this, "请检查输入信息"); } }
Example #30
Source File: WeatherActivity.java From Pigeon with MIT License | 6 votes |
private void updateUserLocation(String city) { User mCurrentUser = BmobUser.getCurrentUser(User.class); if (mCurrentUser != null) { // 允许用户使用应用 User user = new User(); user.setLocation(city); user.update(mCurrentUser.getObjectId(), new UpdateListener() { @Override public void done(BmobException e) { if (e == null) { } else { ToastUtils.showToast(WeatherActivity.this, "Error:" + e.getMessage()); } } }); } else { //缓存用户对象为空时, 可打开用户注册界面… ToastUtils.showToast(WeatherActivity.this, "no cache"); } }