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


Java BmobQuery.addWhereRelatedTo方法代码示例

本文整理汇总了Java中cn.bmob.v3.BmobQuery.addWhereRelatedTo方法的典型用法代码示例。如果您正苦于以下问题:Java BmobQuery.addWhereRelatedTo方法的具体用法?Java BmobQuery.addWhereRelatedTo怎么用?Java BmobQuery.addWhereRelatedTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cn.bmob.v3.BmobQuery的用法示例。


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

示例1: queryBlackList

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
 * 查询黑名单用户
 *
 * @param callback 回调
 */
private void queryBlackList(final FindListener<User> callback) {
        BmobQuery<User> query = new BmobQuery<>();
        query.order("updateAt");
        query.addWhereRelatedTo(COLUMN_NAME_BLACKLIST, new BmobPointer(getCurrentUser()));
        query.findObjects(CustomApplication.getInstance(), new FindListener<User>() {
                        @Override
                        public void onSuccess(List<User> list) {
                                callback.onSuccess(list);
                        }

                        @Override
                        public void onError(int i, String s) {
                                callback.onError(i, s);
                        }
                }
        );
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:23,代码来源:UserManager.java

示例2: getLikesData

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void getLikesData() {
    BmobQuery<MyUser> query = new BmobQuery<>();
    Post post = new Post();
    post.setObjectId(mPost.getObjectId());
    query.addWhereRelatedTo("likes", new BmobPointer(post));
    query.findObjects(new FindListener<MyUser>() {
        @Override
        public void done(List<MyUser> list, BmobException e) {
            if (e == null) {
                if (list.isEmpty()) {
                    mPostDetailLikesRecycler.setVisibility(View.GONE);
                    mLikesNo.setVisibility(View.VISIBLE);
                    mLikesNo.setText(R.string.likes_no);
                } else {
                    mPostDetailLikesRecycler.setVisibility(View.VISIBLE);
                    mLikesNo.setVisibility(View.GONE);
                    mLikesAdapter.setLikesUserData(list);
                    mLikesAdapter.notifyDataSetChanged();
                }
            } else {
                Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
开发者ID:struggledhard,项目名称:USay,代码行数:26,代码来源:PostDetailLikesFragment.java

示例3: queryJoinedUser

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void queryJoinedUser() {
        BmobQuery<User> query = new BmobQuery<>();
        query.addWhereRelatedTo("join", new BmobPointer(mActivity));
        query.findObjects(new FindListener<User>() {
            @Override
            public void done(List<User> list, BmobException e) {
                if (e == null) {
                    if (list.size() > 0) {
                        if (users != null) {
                            users.clear();
                        }
                        users.addAll(list);
                        adapter.notifyDataSetChanged();
//                        并设置人数
                        joinedNum.setText(list.size() + "");
                    } else {
                        showToast("服务器没有数据");
                    }
                    swipeRefreshLayout.setRefreshing(false);
                } else {
                    showToast("访问服务器失败,稍后重试" + e.getMessage() + e.getErrorCode());
                    swipeRefreshLayout.setRefreshing(false);
                }
            }
        });
    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:27,代码来源:JoinedUserActivity.java

示例4: queryFocusUser

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void queryFocusUser() {
    BmobQuery<User> query = new BmobQuery<>();
    query.addWhereRelatedTo("focus", new BmobPointer(user));
    query.findObjects(new FindListener<User>() {
        @Override
        public void done(List<User> list, BmobException e) {
            if (e == null) {
                if (list.size() > 0) {
                    if (users != null) {
                        users.clear();
                    }
                    users.addAll(list);
                    adapter.notifyDataSetChanged();
                } else {
                    showToast("服务器没有数据");
                }
                swipeRefreshLayout.setRefreshing(false);
            } else {
                showToast("访问服务器失败,稍后重试" + e.getMessage() + e.getErrorCode());
                swipeRefreshLayout.setRefreshing(false);
            }
        }
    });
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:25,代码来源:MyFocusActivity.java

示例5: requestFocus

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
 * 请求获取用户关注其他用户
 */
public void requestFocus(User user, final RequestListener<List<User>> listener) {
    if (!checkNet(listener)) return;
    BmobQuery<User> query = new BmobQuery<>();
    query.addWhereRelatedTo("followPerson", new BmobPointer(user));
    query.findObjects(new FindListener<User>() {
        @Override
        public void done(List<User> list, BmobException e) {
            if (e == null) {
                listener.success(list);
            } else {
                listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:19,代码来源:NetRequest.java

示例6: likeComment

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
 * 喜欢文章
 *
 * @param post
 * @param listener
 */
public void likeComment(final Post post, final RequestListener<String> listener) {
    if (!checkNet(listener)) return;
    if (!checkLoginStatus(listener)) return;
    final User user = BmobUser.getCurrentUser(User.class);
    BmobQuery<User> query = new BmobQuery<>();
    query.addWhereRelatedTo("likes", new BmobPointer(post));
    query.findObjects(new FindListener<User>() {
        @Override
        public void done(List<User> list, BmobException e) {
            if (e != null) return;
            for (User u : list) {
                if (u.getObjectId().equals(user.getObjectId())) {
                    removeLikeRequest(post, listener);
                    listener.success("取消收藏成功");
                    return;
                }
            }
            startLikeRequest(post, listener);
        }
    });

}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:29,代码来源:NetRequest.java

示例7: likeComment

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
 * 喜欢文章
 *
 * @param post
 * @param listener
 */
public void likeComment(final Post post, final RequestListener<String> listener) {
    if (!checkNet(listener)) return;
    if (!checkLoginStatus(listener)) return;
    LogUtil.e3(post.getTitle() + ";" + post.getObjectId());
    final User user = BmobUser.getCurrentUser(User.class);
    BmobQuery<User> query = new BmobQuery<>();
    query.addWhereRelatedTo("likes", new BmobPointer(post));
    query.findObjects(new FindListener<User>() {
        @Override
        public void done(List<User> list, BmobException e) {
            if (e != null) return;
            for (User u : list) {
                if (u.getObjectId().equals(user.getObjectId())) {
                    listener.error("已经添加过喜欢");
                    return;
                }
            }
            startLikeRequest(post, listener);
        }
    });

}
 
开发者ID:xujiaji,项目名称:HaiNaBaiChuan,代码行数:29,代码来源:NetRequest.java

示例8: getMyFavourite

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void getMyFavourite() {
    User user = BmobUser.getCurrentUser(mContext, User.class);
    if (user != null) {
        BmobQuery<DianDi> query = new BmobQuery<DianDi>();
        query.addWhereRelatedTo("favorite", new BmobPointer(user));
        query.include("user");
        query.order("createdAt");
        query.setLimit(Constant.NUMBERS_PER_PAGE);
        query.findObjects(mContext, new FindListener<DianDi>() {

            @Override
            public void onSuccess(List<DianDi> data) {
                // TODO Auto-generated method stub
                L.i(TAG, "get fav success!" + data.size());
                ShowToast("fav size:" + data.size());
            }

            @Override
            public void onError(int arg0, String arg1) {
                // TODO Auto-generated method stub
                ShowToast("获取收藏失败。请检查网络~");
            }
        });
    }
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:26,代码来源:PersonCenterAdapter.java

示例9: requestFocusNum

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
 * 请求获取用户关注其他用户数量
 */
public void requestFocusNum(User user, final RequestListener<String> listener) {
    BmobQuery<User> query = new BmobQuery<>();
    query.addWhereRelatedTo("followPerson", new BmobPointer(user));
    query.count(User.class, new CountListener() {
        @Override
        public void done(Integer integer, BmobException e) {
            if (e == null) {
                listener.success(Integer.toString(integer));
            } else {
                listener.success("0");
            }
        }
    });
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:18,代码来源:NetRequest.java

示例10: getMyFavourite

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void getMyFavourite() {
    User user = BmobUser.getCurrentUser(mContext, User.class);
    if (user != null) {
        BmobQuery<DianDi> query = new BmobQuery<DianDi>();
        query.addWhereRelatedTo("favorite", new BmobPointer(user));
        query.include("user");
        query.order("createdAt");
        query.setLimit(Constant.NUMBERS_PER_PAGE);
        query.findObjects(mContext, new FindListener<DianDi>() {

            @Override
            public void onSuccess(List<DianDi> data) {
                L.i(TAG, "get fav success!" + data.size());
                ShowToast("fav size:" + data.size());
            }

            @Override
            public void onError(int arg0, String arg1) {
                ShowToast("获取收藏失败。请检查网络~");
            }
        });
    } else {
        //前往登录注册界面
        ShowToast("获取收藏前请先登录。");
        Intent intent = new Intent();
        intent.setClass(mContext, LoginActivity.class);
        CustomApplication.getInstance().getTopActivity().startActivityForResult(intent, Constant.GET_FAVOURITE);
    }
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:30,代码来源:FeedAdapter.java

示例11: fetchComment

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void fetchComment() {
    BmobQuery<Comment> query = new BmobQuery<Comment>();
    query.addWhereRelatedTo("relation", new BmobPointer(mDianDi));
    query.include("user");
    query.order("createdAt");
    query.setLimit(Constant.NUMBERS_PER_PAGE);
    query.setSkip(Constant.NUMBERS_PER_PAGE * (pageNum++));
    query.findObjects(this, new FindListener<Comment>() {

        @Override
        public void onSuccess(List<Comment> data) {
            // TODO Auto-generated method stub
            L.i(TAG, "get comment success!" + data.size());
            if (data.size() != 0 && data.get(data.size() - 1) != null) {

                if (data.size() < Constant.NUMBERS_PER_PAGE) {
                    //     ShowToast("已加载完所有评论~");
                    footer.setText("暂无更多评论~");
                }

                mAdapter.addAll(data);
                mAdapter.notifyDataSetChanged();
                setListViewHeightBasedOnChildren(commentList);
                L.i(TAG, "refresh");
            } else {
                //   ShowToast("暂无更多评论~");
                footer.setText("暂无更多评论~");
                pageNum--;
            }
        }

        @Override
        public void onError(int arg0, String arg1) {
            // TODO Auto-generated method stub
            ShowToast("获取评论失败。请检查网络~~");
            pageNum--;
        }
    });
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:40,代码来源:CommentActivity.java

示例12: getMyFavourite

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void getMyFavourite() {
    User user = BmobUser.getCurrentUser(this, User.class);
    if (user != null) {
        BmobQuery<DianDi> query = new BmobQuery<DianDi>();
        query.addWhereRelatedTo("favorite", new BmobPointer(user));
        query.include("user");
        query.order("createdAt");
        query.setLimit(Constant.NUMBERS_PER_PAGE);
        query.findObjects(this, new FindListener<DianDi>() {

            @Override
            public void onSuccess(List<DianDi> data) {
                // TODO Auto-generated method stub
                L.i(TAG, "get fav success!" + data.size());
                ShowToast("fav size:" + data.size());
            }

            @Override
            public void onError(int arg0, String arg1) {
                // TODO Auto-generated method stub
                ShowToast("获取收藏失败。请检查网络~");
            }
        });
    } else {
        //前往登录注册界面
        ShowToast("获取收藏前请先登录。");
        Intent intent = new Intent();
        intent.setClass(this, LoginActivity.class);
        startActivityForResult(intent, Constant.GET_FAVOURITE);
    }
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:32,代码来源:CommentActivity.java

示例13: loadData

import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
public void loadData() {
    //  progressbar.setVisibility(View.VISIBLE);

    BmobQuery<DianDi> query = new BmobQuery<DianDi>();
    query.addWhereRelatedTo("favorite", new BmobPointer(mUser));
    query.order("-createdAt");
    query.setLimit(Constant.NUMBERS_PER_PAGE);
    BmobDate date = new BmobDate(new Date(System.currentTimeMillis()));
    query.addWhereLessThan("createdAt", date);
    query.setSkip(Constant.NUMBERS_PER_PAGE * (pageNum++));
    query.include("author");
    query.findObjects(FavoriteActivity.this, new FindListener<DianDi>() {

        @Override
        public void onSuccess(List<DianDi> list) {
            if (list.size() != 0 && list.get(list.size() - 1) != null) {
                {
                    mListItems.clear();
                }
                if (list.size() < Constant.NUMBERS_PER_PAGE) {
                    ShowToast("已加载完所有数据~");
                }
                if (UserHelper.getCurrentUser() != null) {
                    list = DatabaseUtilC.getInstance(mContext).setFav(list);
                }
                mListItems.addAll(list);
                mAdapter.notifyDataSetChanged();

            } else {
                ShowToast("暂无更多数据~");
                if (list.size() == 0 && mListItems.size() == 0) {

                    networkTips.setText("暂无收藏。快去首页收藏几个把~");
                    pageNum--;

                    Log.i(TAG, "SIZE:" + list.size() + "ssssize" + mListItems.size());
                    return;
                }
                pageNum--;
            }
            refreshPull();
        }

        @Override
        public void onError(int arg0, String arg1) {
            // TODO Auto-generated method stub
            L.i(TAG, "find failed." + arg1);
            pageNum--;
            refreshPull();
        }
    });

}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:54,代码来源:FavoriteActivity.java


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