Java Code Examples for com.avos.avoscloud.AVQuery#setLimit()
The following examples show how to use
com.avos.avoscloud.AVQuery#setLimit() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LaunchImage.java From MainScreenShow with GNU General Public License v2.0 | 6 votes |
/** * 从服务器查看是否需要下载图片 * * @param callBack */ public void isDownloadImage(final IsDownloadCallBack callBack) { AVQuery<AVObject> query = new AVQuery<AVObject>(CLASS_NAME); query.orderByDescending(ID); query.setLimit(1); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(List<AVObject> list, AVException e) { if (null == e) { if (list.size() == 1) { if (sp.getInt("image", -1) < list.get(0).getInt(ID)) { callBack.done(true, list.get(0)); } else { callBack.done(false, null); } } else callBack.done(false, null); } else callBack.done(false, null); } }); }
Example 2
Source File: SocialPlatform.java From AnimeTaste with MIT License | 6 votes |
@Override public void onComplete(final Platform platform, int action, HashMap<String, Object> res) { AVQuery<AVObject> query = new AVQuery<AVObject>("Users"); query.whereEqualTo("platform", platform.getName()); query.whereEqualTo("uid", platform.getDb().getUserId()); query.setLimit(1); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(List<AVObject> objects, AVException e) { if (e == null) { if (objects.size() > 0) { saveInformation(platform, true, objects.get(0)); } else { saveInformation(platform, false, null); } } else { mHandler.sendEmptyMessage(AUTH_SAVE_FAILED); } } }); }
Example 3
Source File: CacheService.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public static List<AVUser> findUsers(List<String> userIds) throws AVException { if (userIds.size() <= 0) { return Collections.EMPTY_LIST; } AVQuery<AVUser> q = AVUser.getQuery(); q.whereContainedIn("objectId", userIds); q.setLimit(1000); q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE); return q.find(); }
Example 4
Source File: PlayActivity.java From AnimeTaste with MIT License | 4 votes |
@Override protected Boolean doInBackground(Void... params) { AVQuery<AVObject> query = new AVQuery<AVObject>( "Comments"); query.whereEqualTo("vid", mAnimation.AnimationId); query.setLimit(mStep); query.setSkip(mSkip); query.include("uid"); query.orderByDescending("updatedAt"); try { List<AVObject> commentList = query.find(); if (commentList.size() < mStep) { mCommentFinished = true; } ArrayList<LinearLayout> commentsLayout = new ArrayList<LinearLayout>(); for (AVObject comment : commentList) { AVObject user = comment.getAVObject("uid"); Comment commentInformation = new Comment( user.getString("username"), user.getString("avatar"), user.getString("platform"), comment.getUpdatedAt(), comment.getString("content")); LinearLayout commentItem = (LinearLayout) mLayoutInflater .inflate(R.layout.comment_item, null); TextView content = (TextView) commentItem .findViewById(R.id.content); content.setText(commentInformation.Content); ImageView avatar = (ImageView) commentItem .findViewById(R.id.avatar); Picasso.with(mContext).load(commentInformation.Avatar) .into(avatar); TextView username = (TextView) commentItem .findViewById(R.id.name); username.setText(commentInformation.Username); TextView date = (TextView) commentItem .findViewById(R.id.time); date.setText(mPrettyTime.format(commentInformation.Date)); commentsLayout.add(commentItem); } mSkip += mStep; mCommentCount += commentList.size(); publishProgress(commentsLayout .toArray(new LinearLayout[commentList.size()])); return true; } catch (AVException e) { return false; } }