Skip to content

Commit

Permalink
Card 18 (Add parameter skipEmpty=1 in the album/list.json to not return
Browse files Browse the repository at this point in the history
empty albums)
- ITroveboxApi: added additional parameters skipEmpty to getAlbums
method declaration
- TroveboxApi: added skipEmpty parameter support to the getAlbums method
implementation
- AlbumsEndlessAdapter: added additional required parameter to the
mTroveboxApi.getAlbums call to skip empty albums
  • Loading branch information
httpdispatch committed Oct 9, 2013
1 parent ad37394 commit 69066ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/com/trovebox/android/app/net/ITroveboxApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ AlbumsResponse getAlbums() throws ClientProtocolException, IOException,
/**
* Get albums.
*
* @param resize which sizes should be returned
* @param paging paging information
* @param skipEmpty whether to do not return empty albums
* @return albums which are used on the server
* @throws ClientProtocolException
* @throws IOException
* @throws IllegalStateException
* @throws JSONException
*/
AlbumsResponse getAlbums(Paging paging)
AlbumsResponse getAlbums(Paging paging, boolean skipEmpty)
throws ClientProtocolException, IllegalStateException, IOException,
JSONException;

Expand Down
8 changes: 6 additions & 2 deletions app/src/com/trovebox/android/app/net/TroveboxApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ public AlbumsResponse getAlbums() throws ClientProtocolException,
IOException,
IllegalStateException, JSONException
{
return getAlbums(null);
return getAlbums(null, true);
}

@Override
public AlbumsResponse getAlbums(Paging paging) throws ClientProtocolException,
public AlbumsResponse getAlbums(Paging paging, boolean skipEmpty)
throws ClientProtocolException,
IOException,
IllegalStateException, JSONException
{
ApiRequest request = new ApiRequest(ApiRequest.GET, "/albums/list.json");
addPagingRestrictions(paging, request);
if (skipEmpty) {
request.addParameter("skipEmpty", "1");
}
ApiResponse response = execute(request);
return new AlbumsResponse(response.getJSONObject());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public LoadResponse loadItems(int page)
{
try
{
AlbumsResponse response = mTroveboxApi.getAlbums(new Paging(page,
getPageSize()));
AlbumsResponse response = mTroveboxApi.getAlbums(new Paging(page, getPageSize()),
true);
if (TroveboxResponseUtils.checkResponseValid(response))
{
return new LoadResponse(response.getAlbums(), response.hasNextPage());
Expand Down

0 comments on commit 69066ea

Please sign in to comment.