Search in sources :

Example 1 with Paging

use of com.trovebox.android.common.net.Paging in project mobile-android by photo.

the class PhotosEndlessAdapter method loadItemsGeneral.

public LoadResponse loadItemsGeneral(int page, int pageSize) {
    try {
        CommonUtils.debug(TAG, "loadPhotos: page = %1$d, pageSize = %2$d", page, pageSize);
        TrackerUtils.trackBackgroundEvent(CommonUtils.format("loadPhotos: page = %1$d, pageSize = %2$d", page, pageSize), getClass().getSimpleName());
        long start = System.currentTimeMillis();
        PhotosResponse response = mTroveboxApi.getPhotos(returnSizes, mTagFilter, mAlbumFilter, mToken, sortBy, new Paging(page, pageSize), mHost);
        if (TroveboxResponseUtils.checkResponseValid(response)) {
            TrackerUtils.trackDataLoadTiming(System.currentTimeMillis() - start, CommonUtils.format("loadPhotos: page = %1$d, pageSize = %2$d", page, pageSize), getClass().getSimpleName());
            boolean hasNextPage = response.getCurrentPage() < response.getTotalPages();
            return new LoadResponse(response.getPhotos(), hasNextPage);
        }
    } catch (Exception e) {
        GuiUtils.error(TAG, R.string.errorCouldNotLoadNextPhotosInList, e);
    }
    return new LoadResponse(null, false);
}
Also used : Paging(com.trovebox.android.common.net.Paging) PhotosResponse(com.trovebox.android.common.net.PhotosResponse)

Aggregations

Paging (com.trovebox.android.common.net.Paging)1 PhotosResponse (com.trovebox.android.common.net.PhotosResponse)1