Add "Add to queue" menu button to Playlist Page #2

Merged
teier merged 1 commits from add-playlist-to-queue-menu-button into main 2025-12-07 20:20:10 +00:00
3 changed files with 20 additions and 7 deletions

View File

@@ -129,17 +129,22 @@ public class PlaylistPageFragment extends Fragment implements ClickCallback {
playlistPageViewModel.getPlaylistSongLiveList().observe(getViewLifecycleOwner(), songs -> { playlistPageViewModel.getPlaylistSongLiveList().observe(getViewLifecycleOwner(), songs -> {
if (isVisible() && getActivity() != null) { if (isVisible() && getActivity() != null) {
DownloadUtil.getDownloadTracker(requireContext()).download( DownloadUtil.getDownloadTracker(requireContext()).download(
MappingUtil.mapDownloads(songs), MappingUtil.mapDownloads(songs),
songs.stream().map(child -> { songs.stream().map(child -> {
Download toDownload = new Download(child); Download toDownload = new Download(child);
toDownload.setPlaylistId(playlistPageViewModel.getPlaylist().getId()); toDownload.setPlaylistId(playlistPageViewModel.getPlaylist().getId());
toDownload.setPlaylistName(playlistPageViewModel.getPlaylist().getName()); toDownload.setPlaylistName(playlistPageViewModel.getPlaylist().getName());
return toDownload; return toDownload;
}).collect(Collectors.toList()) }).collect(Collectors.toList())
); );
} }
}); });
return true; return true;
} else if (item.getItemId() == R.id.action_add_to_queue) {
playlistPageViewModel.getPlaylistSongLiveList().observe(getViewLifecycleOwner(), songs -> {
MediaManager.enqueue(mediaBrowserListenableFuture, songs, false);
});
return true;
} else if (item.getItemId() == R.id.action_pin_playlist) { } else if (item.getItemId() == R.id.action_pin_playlist) {
playlistPageViewModel.setPinned(true); playlistPageViewModel.setPinned(true);
return true; return true;

View File

@@ -13,6 +13,13 @@
android:icon="@drawable/ic_file_download" android:icon="@drawable/ic_file_download"
android:title="@string/menu_download_all_button" android:title="@string/menu_download_all_button"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/action_add_to_queue"
android:icon="@drawable/ic_add"
android:title="@string/menu_add_to_queue_button"
app:showAsAction="never" />
<item <item
android:id="@+id/action_pin_playlist" android:id="@+id/action_pin_playlist"
android:icon="@drawable/ic_add" android:icon="@drawable/ic_add"

View File

@@ -157,6 +157,7 @@
<string name="login_title">Subsonic servers</string> <string name="login_title">Subsonic servers</string>
<string name="login_title_expanded">Subsonic servers</string> <string name="login_title_expanded">Subsonic servers</string>
<string name="media_route_menu_title">Cast</string> <string name="media_route_menu_title">Cast</string>
<string name="menu_add_to_queue_button">Add to queue</string>
<string name="menu_add_button">Add</string> <string name="menu_add_button">Add</string>
<string name="menu_download_all_button">Download all</string> <string name="menu_download_all_button">Download all</string>
<string name="menu_download_label">Download</string> <string name="menu_download_label">Download</string>