本文整理汇总了Java中cn.bmob.v3.datatype.BmobRelation.remove方法的典型用法代码示例。如果您正苦于以下问题:Java BmobRelation.remove方法的具体用法?Java BmobRelation.remove怎么用?Java BmobRelation.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.bmob.v3.datatype.BmobRelation
的用法示例。
在下文中一共展示了BmobRelation.remove方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelCollect
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的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());
}
}
});
}
示例2: cancelLike
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void cancelLike() {
BmobRelation relation = new BmobRelation();
// 将当前用户移出这个关系,表明当前用户不喜欢这个帖子
relation.remove(user);
article.setLike(relation);
// 移除当前用户的ID
if (article.getLikeIdList() != null) {
likeIdList = article.getLikeIdList();
}
likeIdList.remove(BmobUser.getCurrentUser(User.class).getObjectId());
article.setLikeIdList(likeIdList);
article.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
// queryLikes();
tvLikeNum.setText("赞("+likeIdList.size()+")");
ivLike.setImageResource(R.drawable.ic_thumb_up_grey_500_24dp);
isLike = false;
} else {
showToast("取消点赞失败!" + e.getMessage() + e.getErrorCode());
}
}
});
}
示例3: cancelCollect
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void cancelCollect() {
BmobRelation relation = new BmobRelation();
relation.remove(BmobUser.getCurrentUser(User.class));
mactivity.setCollect(relation);
// 移除当前用户的收藏ID
if (mactivity.getCollectIdList() != null) {
collectIdList = mactivity.getCollectIdList();
}
collectIdList.remove(BmobUser.getCurrentUser(User.class).getObjectId());
mactivity.setCollectIdList(collectIdList);
mactivity.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());
}
}
});
}
示例4: cancelLike
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void cancelLike() {
BmobRelation relation = new BmobRelation();
// 将当前用户移出这个关系,表明当前用户不喜欢这个帖子
relation.remove(BmobUser.getCurrentUser(User.class));
mactivity.setLike(relation);
// 移除当前用户的ID
if (mactivity.getLikeIdList() != null) {
likeIdList = mactivity.getLikeIdList();
}
likeIdList.remove(BmobUser.getCurrentUser(User.class).getObjectId());
mactivity.setLikeIdList(likeIdList);
mactivity.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
tvLikeNum.setText("赞(" + likeIdList.size() + ")");
ivLike.setImageResource(R.drawable.ic_thumb_up_grey_500_24dp);
isLike = false;
} else {
showToast("取消点赞失败!" + e.getMessage() + e.getErrorCode());
}
}
});
}
示例5: stopFollowRequest
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void stopFollowRequest(User user, final RequestListener<String> listener) {
final User currentUser = BmobUser.getCurrentUser(User.class);
BmobRelation relation = new BmobRelation();
relation.remove(user);
currentUser.setFollowPerson(relation);
currentUser.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
listener.success(null);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例6: removeLikeRequest
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void removeLikeRequest(Post post, final RequestListener<String> listener) {
final User user = BmobUser.getCurrentUser(User.class);
//将当前用户添加到Post表中的likes字段值中,表明当前用户喜欢该帖子
BmobRelation relation = new BmobRelation();
//将当前用户去除到多对多关联中
relation.remove(user);
//多对多关联指向`post`的`likes`字段
post.setLikes(relation);
post.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
listener.success(null);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例7: deleteBlackRelation
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void deleteBlackRelation(User user, UpdateListener listener) {
User currentUser = new User();
BmobRelation relation = new BmobRelation();
relation.remove(user);
currentUser.setBlack(relation);
currentUser.setObjectId(getCurrentUserObjectId());
currentUser.update(CustomApplication.getInstance(), listener);
}
示例8: cancelFocus
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void cancelFocus() {
BmobRelation relation = new BmobRelation();
relation.remove(dynamicAuthor);
user.setFocus(relation);
// 移除当前用户的ID
if (user.getFocusIds() != null) {
focusId = user.getFocusIds();
}
focusId.remove(dynamicAuthor.getObjectId());
user.setFocusIds(focusId);
user.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
tvFocus.setText("关注");
String nums = tvFan.getText().toString();
Integer num = Integer.valueOf(nums);
Integer numshow = num - 1;
tvFan.setText(numshow.toString());
isFocus = false;
} else {
showToast("取消关注失败!" + e.getMessage() + e.getErrorCode());
}
}
});
}
示例9: onClickFav
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void onClickFav(View v, DianDi DianDi) {
// TODO Auto-generated method stub
User user = BmobUser.getCurrentUser(mContext, User.class);
if (user != null && user.getSessionToken() != null) {
BmobRelation favRelaton = new BmobRelation();
DianDi.setMyFav(!DianDi.getMyFav());
if (DianDi.getMyFav()) {
((ImageView) v).setImageResource(R.drawable.ic_action_fav_choose);
favRelaton.add(DianDi);
ShowToast("收藏成功。");
} else {
((ImageView) v).setImageResource(R.drawable.ic_action_fav_normal);
favRelaton.remove(DianDi);
ShowToast("取消收藏。");
}
user.setFavorite(favRelaton);
user.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
L.i(TAG, "收藏成功。");
//try get fav to see if fav success
// getMyFavourite();
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
L.i(TAG, "收藏失败。请检查网络~");
ShowToast("收藏失败。请检查网络~" + arg0);
}
});
}
}
示例10: onClickFav
import cn.bmob.v3.datatype.BmobRelation; //导入方法依赖的package包/类
private void onClickFav(View v) {
// TODO Auto-generated method stub
User user = BmobUser.getCurrentUser(this, User.class);
if (user != null && user.getSessionToken() != null) {
BmobRelation favRelaton = new BmobRelation();
mDianDi.setMyFav(!mDianDi.getMyFav());
if (mDianDi.getMyFav()) {
((ImageView) v).setImageResource(R.drawable.ic_action_fav_choose);
favRelaton.add(mDianDi);
ShowToast("收藏成功。");
} else {
((ImageView) v).setImageResource(R.drawable.ic_action_fav_normal);
favRelaton.remove(mDianDi);
ShowToast("取消收藏。");
}
user.setFavorite(favRelaton);
user.update(this, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
L.i(TAG, "收藏成功。");
ShowToast("收藏成功。");
//try get fav to see if fav success
// getMyFavourite();
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
L.i(TAG, "收藏失败。请检查网络~");
ShowToast("收藏失败。请检查网络~" + arg0);
}
});
} else {
//前往登录注册界面
ShowToast("收藏前请先登录。");
Intent intent = new Intent();
intent.setClass(this, LoginActivity.class);
startActivityForResult(intent, Constant.SAVE_FAVOURITE);
}
}