aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-01-18 17:31:54 -0800
committerScott Jackson <daneren2005@gmail.com>2016-01-18 17:31:54 -0800
commit4f87e7ba19d5d36322c2c783edf4b7b9c7874594 (patch)
tree2f2919b30466b6eb82e0883f2c0c9d1b5d9a6641
parent061c08ba76f3fb54912dcb84b3c7d440755a87a2 (diff)
downloaddsub-4f87e7ba19d5d36322c2c783edf4b7b9c7874594.tar.gz
dsub-4f87e7ba19d5d36322c2c783edf4b7b9c7874594.tar.bz2
dsub-4f87e7ba19d5d36322c2c783edf4b7b9c7874594.zip
Auto: don't dispay more albums/episodes than the system will display
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java b/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java
index aa353def..c448a360 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java
@@ -58,6 +58,7 @@ public class AutoMediaBrowserService extends MediaBrowserService {
private static final String PODCAST_PREFIX = "po-";
private static final String ALBUM_TYPE_PREFIX = "ty-";
private static final String MUSIC_DIRECTORY_PREFIX = "md-";
+ private static final int MAX_DOUBLE_LINE_ITEMS = 9;
private DownloadService downloadService;
private Handler handler = new Handler();
@@ -194,7 +195,7 @@ public class AutoMediaBrowserService extends MediaBrowserService {
albumListType = "newest";
}
- return musicService.getAlbumList(albumListType, 40, 0, true, downloadService, null);
+ return musicService.getAlbumList(albumListType, MAX_DOUBLE_LINE_ITEMS, 0, true, downloadService, null);
}
@Override
@@ -286,6 +287,7 @@ public class AutoMediaBrowserService extends MediaBrowserService {
protected void done(MusicDirectory podcasts) {
List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();
+ int i = 0;
for(Entry entry: podcasts.getChildren(false, true)) {
PodcastEpisode podcast = (PodcastEpisode) entry;
Bundle podcastExtras = new Bundle();
@@ -300,6 +302,10 @@ public class AutoMediaBrowserService extends MediaBrowserService {
.build();
mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_PLAYABLE));
+ i++;
+ if(i >= MAX_DOUBLE_LINE_ITEMS) {
+ break;
+ }
}
result.sendResult(mediaItems);