Search in sources :

Example 1 with Lost

use of com.itculturalfestival.smartcampus.entity.db.Lost in project SmartCampus by Vegen.

the class LostAndFoundPresenter method getLostList.

@Override
public void getLostList(int SKIP, int skip) {
    BmobQuery<Lost> query = new BmobQuery<Lost>();
    // query.setCachePolicy(BmobQuery.CachePolicy.CACHE_THEN_NETWORK);   // 先从缓存获取数据,如果没有,再从网络获取。
    // 按照时间降序
    query.order("-createdAt");
    // 每次加载条数
    query.setLimit(SKIP);
    // 偏移量
    query.setSkip(skip);
    Subscription subscription = query.findObjects(new FindListener<Lost>() {

        @Override
        public void done(List<Lost> list, BmobException e) {
            if (mView != null) {
                if (e == null) {
                    // 请求成功
                    mView.showLostList(list);
                    mView.hideLoading(false);
                    if (list == null || list.isEmpty()) {
                        mView.loadMoreEnd(true);
                    }
                } else {
                    mView.showMessage(HttpError.getErrorMessage(e));
                    mView.hideLoading(true);
                    mView.loadMoreFail();
                }
            }
        }
    });
    mHttpLinkers.add(new SubscriptionHolder(subscription));
}
Also used : Lost(com.itculturalfestival.smartcampus.entity.db.Lost) BmobException(cn.bmob.v3.exception.BmobException) BmobQuery(cn.bmob.v3.BmobQuery) SubscriptionHolder(com.itculturalfestival.smartcampus.network.SubscriptionHolder) Subscription(rx.Subscription)

Aggregations

BmobQuery (cn.bmob.v3.BmobQuery)1 BmobException (cn.bmob.v3.exception.BmobException)1 Lost (com.itculturalfestival.smartcampus.entity.db.Lost)1 SubscriptionHolder (com.itculturalfestival.smartcampus.network.SubscriptionHolder)1 Subscription (rx.Subscription)1