本文整理匯總了Java中cn.bmob.v3.BmobQuery.setSkip方法的典型用法代碼示例。如果您正苦於以下問題:Java BmobQuery.setSkip方法的具體用法?Java BmobQuery.setSkip怎麽用?Java BmobQuery.setSkip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.bmob.v3.BmobQuery
的用法示例。
在下文中一共展示了BmobQuery.setSkip方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: pullReleasePost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取該用戶發布的帖子
*
* @param currentIndex
* @param size
* @param listener
*/
public void pullReleasePost(String userId, int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.addWhereEqualTo("author", userId); // 查詢當前用戶的所有帖子
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-updatedAt");
query.include("author");// 希望在查詢帖子信息的同時也把發布人的信息查詢出來
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例2: pullCollectPost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取收藏/喜歡的帖子
*
* @param currentIndex
* @param size
* @param listener
*/
public void pullCollectPost(String userId, int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
BmobQuery<User> innerQuery = new BmobQuery<>();
innerQuery.addWhereEqualTo("objectId", userId);
query.addWhereMatchesQuery("likes", "_User", innerQuery);
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-createdAt");
query.include("author");
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例3: pullPostList
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取帖子數據集合
*
* @param size 獲取的數據條數
* @return
*/
public void pullPostList(int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-createdAt");
query.include("author");
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例4: pullReleasePost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取該用戶發布的帖子
* @param currentIndex
* @param size
* @param listener
*/
public void pullReleasePost(int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.addWhereEqualTo("author", BmobUser.getCurrentUser()); // 查詢當前用戶的所有帖子
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-updatedAt");
query.include("author");// 希望在查詢帖子信息的同時也把發布人的信息查詢出來
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list,BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例5: pullCollectPost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取收藏/喜歡的帖子
* @param currentIndex
* @param size
* @param listener
*/
public void pullCollectPost(String userId, int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
BmobQuery<User> innerQuery = new BmobQuery<>();
innerQuery.addWhereEqualTo("objectId", userId);
query.addWhereMatchesQuery("likes", "_User", innerQuery);
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-createdAt");
query.include("author");
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例6: executeInternal
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
@Override
protected void executeInternal(final int requestType, boolean showDialog) {
BmobQuery<MomentsInfo> query = new BmobQuery<>();
query.order("-createdAt");
query.include(MomentsFields.AUTHOR_USER + "," + MomentsFields.HOST);
query.setLimit(count);
query.setSkip(curPage * count);
query.setCachePolicy(isFirstRequest? BmobQuery.CachePolicy.CACHE_ELSE_NETWORK: BmobQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.findObjects(new FindListener<MomentsInfo>() {
@Override
public void done(List<MomentsInfo> list, BmobException e) {
if (!ToolUtil.isListEmpty(list)) {
queryCommentAndLikes(list);
}
}
});
}
示例7: loadPost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 分頁加載數據
* 從Bmob上加載數據
*/
private void loadPost() {
currentPageIndex = 0;
BmobQuery<Post> query = new BmobQuery<>();
query.order("-createdAt");
query.include("author");// 希望在查詢帖子信息的同時也把發布人的信息查詢出來
query.setLimit(PAGE_SIZE);
query.setSkip(PAGE_SIZE * currentPageIndex);
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (mShequRefresh != null && mShequRefresh.isRefreshing()) {
mShequRefresh.setRefreshing(false);
}
if (e == null) {
if (list != null && list.size() != 0) {
mSheQuAdapter.setPostData(list);
mSheQuAdapter.notifyDataSetChanged();
} else {
Toast.makeText(getActivity(), "還沒帖子,趕緊發布吧!", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(getActivity(), "查詢失敗" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
示例8: loadMorePost
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 分頁加載數據
* 從Bmob上加載更多數據
*/
private void loadMorePost() {
++currentPageIndex;
BmobQuery<Post> query = new BmobQuery<>();
query.order("-createdAt");
query.include("author");// 希望在查詢帖子信息的同時也把發布人的信息查詢出來
query.setLimit(PAGE_SIZE);
query.setSkip(PAGE_SIZE * currentPageIndex);
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (mShequRefresh != null && mShequRefresh.isRefreshing()) {
mShequRefresh.setRefreshing(false);
}
if (e == null) {
if (list != null && list.size() != 0) {
mSheQuAdapter.setPostMoreData(list);
mSheQuAdapter.notifyDataSetChanged();
} else {
Toast.makeText(getActivity(), "沒有更多數據!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), "查詢失敗" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
示例9: queryComment
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
public void queryComment(int page, Topic topic, FindListener<Comment> listener){
BmobQuery<Comment> query = new BmobQuery<>();
query.addWhereEqualTo("mTopic", new BmobPointer(topic));
query.include("user,topic.author");
query.setLimit(5);
query.setSkip((page-1)*5);
query.findObjects(mContext, listener);
}
示例10: queryAllTopic
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
public void queryAllTopic(int curPage, String placeName, FindListener<Topic> listener){
BmobQuery<Topic> query = new BmobQuery<>();
query.addWhereEqualTo("placeName", placeName);
query.include("author");
query.setLimit(3);
query.setSkip((curPage - 1) * 3);
query.order("-time");
query.findObjects(mContext, listener);
}
示例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: loadData
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
protected void loadData() {
BmobQuery<DianDi> query = new BmobQuery<DianDi>();
query.setLimit(Constant.NUMBERS_PER_PAGE);
query.setSkip(Constant.NUMBERS_PER_PAGE * (pageNum++));
query.order("-createdAt");
query.include("author");
query.addWhereEqualTo("author", mUser);
query.findObjects(this, new FindListener<DianDi>() {
@Override
public void onSuccess(List<DianDi> data) {
if (data.size() != 0 && data.get(data.size() - 1) != null) {
mDianDis.clear();
if (data.size() < Constant.NUMBERS_PER_PAGE) {
// ShowToast("已加載完所有數據~");
}
mDianDis.addAll(data);
mAdapter.notifyDataSetChanged();
} else
{
ShowToast("暫無更多數據~");
pageNum--;
}
refreshPull();
}
@Override
public void onError(int arg0, String msg) {
// TODO Auto-generated method stub
L.i(TAG, "find failed." + msg);
pageNum--;
refreshPull();
}
}
);
}
示例13: putToRefreshByContent
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
private void putToRefreshByContent(final int actionType) {
//初始化Bmob查詢類
BmobQuery<Content> query = new BmobQuery<>();
query.setLimit(PAGE_LIMIT);
if (actionType == REFRESH_TYPE_PULL) {
mCurrentPageCount = 0;
query.setSkip(0);
} else {
int currentPageLimit = mAdapter.getCount();
if (currentPageLimit < PAGE_LIMIT) {
query.setSkip(currentPageLimit);
} else {
query.setSkip(PAGE_LIMIT * (mCurrentPageCount + 1));
}
}
String sql = "select title,small,createdAt from Content where point='"+mPoint.getObjectId()+"' order by updatedAt DESC";
query.doSQLQuery(AppContext.getInstance(), sql, new SQLQueryListener<Content>() {
@Override
public void done(BmobQueryResult<Content> bmobQueryResult, BmobException e) {
if (e == null) {
//請求成功
List<Content> list = bmobQueryResult.getResults();
if (actionType == REFRESH_TYPE_PULL) {
mContentListAdapter.notifyAdapter(list);
//把數據緩存到本地
SaveCacheAsyncTask savecaheTask = new SaveCacheAsyncTask(getContext(), (Serializable) list, CacheHelper.CONTENT_LIST_CACHE_KEY + mPoint.getName());
savecaheTask.execute();
if (list.size() != 0) {
mLoadingLayout.setLoadingLayout(LoadingLayout.HIDE_LAYOUT);
mPtrFrameLayout.setVisibility(View.VISIBLE);
} else {
mLoadingLayout.setLoadingLayout(LoadingLayout.NETWORK_REFRESH);
mPtrFrameLayout.setVisibility(View.GONE);
}
//更新UI
mPtrFrameLayout.refreshComplete();
} else {
//如果目前的數據數量大於等 該知識點的所有內容數量 即視為加載完全部數據。 加上後麵的大於條件是為了防止 用戶在上啦加載時服務器增加了一條數據而導致上啦加載出現數據錯亂
if (mContentListAdapter.getCount() == mContentCount || mContentListAdapter.getCount() > mContentCount) {
sPutUpState = PULL_UP_STATE_NOMORE;
updateFooterViewStateText();
} else {
mContentListAdapter.addData(list);
removeFootView();
}
}
} else {
//請求失敗
Logger.e(e.getMessage());
if (actionType == REFRESH_TYPE_PULL) {
//更新UI
toastError(mLoadingLayout, getContext());
} else {
sPutUpState = PULL_UP_STATE_EEROR;
updateFooterViewStateText();
}
}
}
});
}
示例14: pullPostList
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
/**
* 獲取帖子數據集合
*
* @param size 獲取的數據條數
* @return
*/
public void pullPostList(int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-createdAt");
query.include("author");
//先判斷是否有緩存
// boolean isCache = query.hasCachedResult(Post.class);
// if(isCache){
// query.setCachePolicy(BmobQuery.CachePolicy.CACHE_ELSE_NETWORK); // 先從緩存取數據,如果沒有的話,再從網絡取。
// }else{
// query.setCachePolicy(BmobQuery.CachePolicy.NETWORK_ELSE_CACHE); // 如果沒有緩存的話,則先從網絡中取
// }
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
// query.findObjectsObservable(Post.class)
// .map(new Func1<List<Post>, List<Post>>() {
// @Override
// public List<Post> call(List<Post> posts) {
// for (final Post post : posts) {
// String objectId = post.getAuthor().getObjectId();
// BmobQuery<User> query = new BmobQuery<>();
// query.addWhereEqualTo("objectId", objectId);
// query.findObjects(new FindListener<User>() {
// @Override
// public void done(List<User> object, BmobException e) {
// if (e == null) {
// if (object.size() > 0)
// post.setAuthor(object.get(0));
// }
// }
// });
// }
// return posts;
// }
// })
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Subscriber<List<Post>>() {
// @Override
// public void onCompleted() {
//
// }
//
// @Override
// public void onError(Throwable throwable) {
// LogUtil.e2(throwable.toString());
// listener.error(throwable.toString());
// }
//
// @Override
// public void onNext(List<Post> posts) {
// listener.success(posts);
// }
// });
}
示例15: requestData
import cn.bmob.v3.BmobQuery; //導入方法依賴的package包/類
@Override
protected void requestData() {
BmobQuery<GankBmob> bmobQuery = new BmobQuery<GankBmob>();
bmobQuery.order("-createdAt");
bmobQuery.setLimit(Constants.PageSize);
bmobQuery.addWhereEqualTo("uid", PreferenceManager.getInstance(this).getUid());
bmobQuery.setSkip(Constants.PageSize * (pageNo++));
bmobQuery.findObjects(this, new FindListener<GankBmob>() {
@Override
public void onSuccess(List<GankBmob> gankBmobs) {
if (gankBmobs.size() > 0) {
if (multiStateView.getViewState() == MultiStateView.VIEW_STATE_LOADING || isRefresh) {
multiStateView.setViewState(MultiStateView.VIEW_STATE_CONTENT);
swipeRefreshLayout.setRefreshing(false);
isRefresh = false;
list.clear();
} else {
if (gankBmobs.size() < Constants.PageSize) {
RecyclerViewStateUtils.setFooterViewState(MineCollect.this, collectRecyclerview, Constants.PageSize, LoadingFooter.State.TheEnd, null);
} else {
RecyclerViewStateUtils.setFooterViewState(MineCollect.this, collectRecyclerview, Constants.PageSize, LoadingFooter.State.Normal, null);
}
}
list.addAll(gankBmobs);
adapter.notifyDataSetChanged();
} else {
if (multiStateView.getViewState() == MultiStateView.VIEW_STATE_LOADING || isRefresh) {
multiStateView.setViewState(MultiStateView.VIEW_STATE_EMPTY);
swipeRefreshLayout.setRefreshing(false);
} else {
RecyclerViewStateUtils.setFooterViewState(MineCollect.this, collectRecyclerview, Constants.PageSize, LoadingFooter.State.TheEnd, null);
}
}
}
@Override
public void onError(int i, String s) {
if (multiStateView.getViewState() == MultiStateView.VIEW_STATE_LOADING || isRefresh) {
multiStateView.setViewState(MultiStateView.VIEW_STATE_ERROR);
swipeRefreshLayout.setRefreshing(false);
SnackbarUtil.checkErrorCode(mContext, i, getWindow().getDecorView(),null);
} else {
RecyclerViewStateUtils.setFooterViewState(MineCollect.this, collectRecyclerview, Constants.PageSize, LoadingFooter.State.NetWorkError, reLoadClick);
}
}
});
}