本文整理匯總了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);
}
}
);
}
示例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();
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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()));
}
}
});
}
示例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);
}
});
}
示例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);
}
});
}
示例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("獲取收藏失敗。請檢查網絡~");
}
});
}
}
示例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");
}
}
});
}
示例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);
}
}
示例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--;
}
});
}
示例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);
}
}
示例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();
}
});
}