當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。