本文整理汇总了Java中cn.bmob.v3.listener.UpdateListener类的典型用法代码示例。如果您正苦于以下问题:Java UpdateListener类的具体用法?Java UpdateListener怎么用?Java UpdateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UpdateListener类属于cn.bmob.v3.listener包,在下文中一共展示了UpdateListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteUserFace
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
}
});
}
示例2: deleteUser
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
}
});
}
示例3: saveNewFriendToServer
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
/**
* 在服务器上关联该好友
*
* @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, "不是当前的用户,不在服务器上关联该好友");
}
}
示例4: addToBlack
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
/**
* 添加为黑名单
*
* @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));
}
}
);
}
示例5: cancelBlack
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
/**
* 取消黑名单回调
*
* @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));
}
}
);
}
示例6: addLiker
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
示例7: deleteLiker
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
示例8: deleteComment
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
}
示例9: updateUserAvatar
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
示例10: updateUserSignature
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
示例11: updateUserNick
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
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);
}
});
}
示例12: onClick
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
@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;
}
}
示例13: refreshData
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
/**
* 刷新数据操作
*/
private void refreshData(List<KeepInfo> mDatas){
MyUser bmobUser=BmobUser.getCurrentUser(MyUser.class);
if (bmobUser!=null){
MyUser newUser=new MyUser();
newUser.setValue("keep",mDatas);
newUser.update(bmobUser.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e==null){
Toast.makeText(UIUtils.getContext(),"删除成功",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(UIUtils.getContext(),"删除失败 请重试",Toast.LENGTH_SHORT).show();
}
}
});
}
}
示例14: toCollect
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
private void toCollect() {
BmobRelation relation = new BmobRelation();
// 将当前用户添加到MActivity表中的collect字段中,表名当前用户收藏了该活动内容
relation.add(BmobUser.getCurrentUser(User.class));
article.setCollect(relation);
if (article.getCollectIdList() != null) {
collectIdList = article.getCollectIdList();
}
collectIdList.add(user.getObjectId());
article.setCollectIdList(collectIdList);
article.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Log.e(TAG, "收藏成功");
ivCollect.setImageResource(R.drawable.ic_favorite_orange_500_24dp);
isCollect = true;
} else {
Log.e(TAG, "收藏失败" + e.getMessage() + e.getErrorCode());
}
}
});
}
示例15: cancelCollect
import cn.bmob.v3.listener.UpdateListener; //导入依赖的package包/类
private void cancelCollect() {
BmobRelation relation = new BmobRelation();
relation.remove(BmobUser.getCurrentUser(User.class));
article.setCollect(relation);
// 移除当前用户的收藏ID
if (article.getCollectIdList() != null) {
collectIdList = article.getCollectIdList();
}
collectIdList.remove(user.getObjectId());
article.setCollectIdList(collectIdList);
article.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Log.e(TAG, "取消收藏成功");
ivCollect.setImageResource(R.drawable.ic_favorite_border_grey_500_24dp);
isCollect = false;
} else {
Log.e(TAG, "取消收藏失败" + e.getErrorCode() + e.getMessage());
}
}
});
}