From ca34b1b7efdfca4de6e1ed220f41e22286254532 Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Mon, 15 Jan 2018 09:06:13 -0800 Subject: Changes AA song selection to play the directory --- .../dsub/service/AutoMediaBrowserService.java | 25 +++++++++++++++++----- .../dsub/util/compat/RemoteControlClientLP.java | 2 +- 2 files changed, 21 insertions(+), 6 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 35f6d37a..88cfe559 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/AutoMediaBrowserService.java @@ -279,12 +279,18 @@ public class AutoMediaBrowserService extends MediaBrowserService { // music files for(Entry entry: indexes.getEntries()) { + entry.setBookmark(null); // don't resume from a bookmark in a browse listing + Bundle extras = new Bundle(); + extras.putSerializable(Constants.INTENT_EXTRA_ENTRY, entry); + extras.putString(Constants.INTENT_EXTRA_NAME_CHILD_ID, entry.getId()); + MediaDescription description = new MediaDescription.Builder() .setTitle(entry.getTitle()) - .setMediaId(MUSIC_DIRECTORY_PREFIX + entry.getId()) + .setMediaId(entry.getId()) + .setExtras(extras) .build(); - mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE)); + mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_PLAYABLE)); } result.sendResult(mediaItems); @@ -315,15 +321,24 @@ public class AutoMediaBrowserService extends MediaBrowserService { .setTitle(entry.getTitle()) .setMediaId(MUSIC_DIRECTORY_CONTENTS_PREFIX + entry.getId()) .build(); + + mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE)); } else { - // playback options for a single item + // mark individual songs as directly playable + entry.setBookmark(null); // don't resume from a bookmark in a browse listing + Bundle extras = new Bundle(); + extras.putSerializable(Constants.INTENT_EXTRA_ENTRY, entry); + extras.putString(Constants.INTENT_EXTRA_NAME_CHILD_ID, entry.getId()); + description = new MediaDescription.Builder() .setTitle(entry.getTitle()) - .setMediaId(MUSIC_DIRECTORY_PREFIX + entry.getId()) + .setMediaId(entry.getId()) + .setExtras(extras) .build(); + + mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_PLAYABLE)); } - mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE)); } result.sendResult(mediaItems); } diff --git a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java index 00bca833..461f89dc 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java +++ b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java @@ -564,7 +564,7 @@ public class RemoteControlClientLP extends RemoteControlClientBase { playSong(entry, true); } - // Currently only happens when playing bookmarks so we should be looking up parent + // Enqueue an entire directory when selecting a bookmark or a song String childId = extras.getString(Constants.INTENT_EXTRA_NAME_CHILD_ID, null); if(childId != null) { if(Util.isTagBrowsing(downloadService) && !Util.isOffline(downloadService)) { -- cgit v1.2.3