From ee7e6ccf72a4f91f47c7db8c7e0f2837ba1833ec Mon Sep 17 00:00:00 2001 From: Siddhesh Naik Date: Sun, 17 Sep 2023 15:33:08 +0530 Subject: [PATCH] Add playlist name and video name in playlist sharing content - Currently, only a list of videos separated by newline are added in the share content. - This makes it difficult to identify a specific video in a list of Urls. - Added Playlist name as the header and corresponding video name for each video url in following format. ``` My Playlist - Music1: https://media-url1 - Music2: https://media-url2 - Music3: https://media-url3 ``` Screenshot: | Before | After | | --- | --- | | | | --- .../newpipe/local/playlist/LocalPlaylistFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index 0d8f8133440..a4023ce947b 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -374,16 +374,18 @@ public boolean onOptionsItemSelected(final MenuItem item) { } /** - * Share the playlist as a newline-separated list of stream URLs. + * Share the playlist as a newline-separated list of stream URLs and video names. */ public void sharePlaylist() { disposables.add(playlistManager.getPlaylistStreams(playlistId) .flatMapSingle(playlist -> Single.just(playlist.stream() .map(PlaylistStreamEntry::getStreamEntity) - .map(StreamEntity::getUrl) + .map(streamEntity -> String.format("- %s: %s", + streamEntity.getTitle(), streamEntity.getUrl())) .collect(Collectors.joining("\n")))) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(urlsText -> ShareUtils.shareText(requireContext(), name, urlsText), + .subscribe(urlsText -> ShareUtils.shareText( + requireContext(), name, String.format("%s\n%s", name, urlsText)), throwable -> showUiErrorSnackbar(this, "Sharing playlist", throwable))); }