当前位置: 首页>>代码示例>>Java>>正文


Java BmobRelation类代码示例

本文整理汇总了Java中cn.bmob.v3.datatype.BmobRelation的典型用法代码示例。如果您正苦于以下问题:Java BmobRelation类的具体用法?Java BmobRelation怎么用?Java BmobRelation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BmobRelation类属于cn.bmob.v3.datatype包,在下文中一共展示了BmobRelation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveNewFriendToServer

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的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, "不是当前的用户,不在服务器上关联该好友");
                }
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:27,代码来源:UserManager.java

示例2: toCollect

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的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());
                }
            }
        });

    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:ArticleDetailActivity.java

示例3: 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());
            }
        }
    });
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:ArticleDetailActivity.java

示例4: 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());
                }
            }
        });
    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:ArticleDetailActivity.java

示例5: toCollect

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void toCollect() {
        BmobRelation relation = new BmobRelation();
//        将当前用户添加到MActivity表中的collect字段中,表名当前用户收藏了该活动内容
        relation.add(BmobUser.getCurrentUser(User.class));
        mactivity.setCollect(relation);

        if (mactivity.getCollectIdList() != null) {
            collectIdList = mactivity.getCollectIdList();
        }
        collectIdList.add(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_orange_500_24dp);
                    isCollect = true;
                } else {
                    Log.e(TAG, "收藏失败" + e.getMessage() + e.getErrorCode());
                }
            }
        });

    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:26,代码来源:ActivityDetailActivity.java

示例6: 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());
                }
            }
        });
    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:ActivityDetailActivity.java

示例7: 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());
                }
            }
        });
    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:ActivityDetailActivity.java

示例8: startFollowRequest

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void startFollowRequest(User user, final RequestListener<String> listener) {
    final User currentUser = BmobUser.getCurrentUser(User.class);
    BmobRelation relation = new BmobRelation();
    relation.add(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()));
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:17,代码来源:NetRequest.java

示例9: 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()));
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:17,代码来源:NetRequest.java

示例10: startLikeRequest

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void startLikeRequest(Post post, final RequestListener<String> listener) {
    final User user = BmobUser.getCurrentUser(User.class);
    //将当前用户添加到Post表中的likes字段值中,表明当前用户喜欢该帖子
    BmobRelation relation = new BmobRelation();
    //将当前用户添加到多对多关联中
    relation.add(user);
    //多对多关联指向`post`的`likes`字段
    post.setLikes(relation);
    post.update(new UpdateListener() {
        @Override
        public void done(BmobException e) {
            if (e == null) {
                listener.success("收藏成功");
            } else {
                listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:20,代码来源:NetRequest.java

示例11: 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()));
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:20,代码来源:NetRequest.java

示例12: startLikeRequest

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void startLikeRequest(Post post, final RequestListener<String> listener) {
    final User user = BmobUser.getCurrentUser(User.class);
    //将当前用户添加到Post表中的likes字段值中,表明当前用户喜欢该帖子
    BmobRelation relation = new BmobRelation();
    //将当前用户添加到多对多关联中
    relation.add(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()));
            }
        }
    });
}
 
开发者ID:xujiaji,项目名称:HaiNaBaiChuan,代码行数:20,代码来源:NetRequest.java

示例13: buildAndAddFriend

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void buildAndAddFriend() {
	UserSoicalInfo userSoicalInfo = new UserSoicalInfo();
	RunUser runUser = BmobUser.getCurrentUser(RunUser.class);
	userSoicalInfo.setRunner(runUser);//一对一关系
	BmobRelation relation = new BmobRelation();
	relation.add(mFriRunner);
	userSoicalInfo.setFriends(relation);
	userSoicalInfo.save(new SaveListener<String>() {

		@Override
		public void done(String arg0, BmobException e) {
			// TODO Auto-generated method stub
			if(e==null){
				Log.i(MainActivity.TAG, "add friend ok");
				Toast.makeText(getApplicationContext(), "add friend ok", Toast.LENGTH_SHORT).show();
				
			}else{
				Log.i(MainActivity.TAG, "add friend fail err="+e.getMessage());
				Toast.makeText(getApplicationContext(), "add friend fail", Toast.LENGTH_SHORT).show();
			}
		}
	});
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:24,代码来源:SearchFriends.java

示例14: addFriend

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void addFriend(UserSoicalInfo userSoicalInfo){
	BmobRelation relation = new BmobRelation();
	relation.add(mFriRunner);
	userSoicalInfo.setFriends(relation);
	userSoicalInfo.update(new UpdateListener() {
		
		@Override
		public void done(BmobException e) {
			// TODO Auto-generated method stub
			if(e==null){
				Log.i(MainActivity.TAG, "update soicalFri ok");
			}else{
				Log.i(MainActivity.TAG, "update soicalFri fail");
				}
			}
	});
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:18,代码来源:SearchFriends.java

示例15: toFocus

import cn.bmob.v3.datatype.BmobRelation; //导入依赖的package包/类
private void toFocus() {

//        将动态作者的ID添加
        if (user.getFocusIds() != null) {
            focusId = user.getFocusIds();
        }
        BmobRelation relation = new BmobRelation();
        relation.add(dynamicAuthor);
        user.setFocus(relation);
        focusId.add(dynamicAuthor.getObjectId());
        user.setFocusIds(focusId);
        user.update(new UpdateListener() {
            @Override
            public void done(BmobException e) {
                if (e == null) {
                    tvFocus.setText("已关注");
                    isFocus = true;
                    String nums = tvFan.getText().toString();
                    Integer num = Integer.valueOf(nums);
                    Integer numshow = num + 1;
                    tvFan.setText(numshow.toString());
                } else {
                    showToast("关注失败" + e.getMessage() + e.getErrorCode());
                }
            }
        });

    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:29,代码来源:PersonPageActivity.java


注:本文中的cn.bmob.v3.datatype.BmobRelation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。