Skip to content

Commit

Permalink
Add documentation and make small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiGr committed Sep 26, 2023
1 parent cde8fb5 commit 2e198e6
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
* shared content.
*/
private void sharePlaylist(final boolean shouldSharePlaylistDetails) {
final Context context = getContext();
if (context == null) {
return;
}
final Context context = requireContext();

disposables.add(playlistManager.getPlaylistStreams(playlistId)
.flatMapSingle(playlist -> Single.just(playlist.stream()
Expand Down Expand Up @@ -862,21 +859,22 @@ private PlayQueue getPlayQueue(final int index) {
return new SinglePlayQueue(streamInfoItems, index);
}

/**
* Creates a dialog to confirm whether the user wants to share the playlist
* with the playlist details or just the list of stream URLs.
* After the user has made a choice, the playlist is shared.
*/
private void createShareConfirmationDialog() {
if (getContext() == null) {
return;
}

new AlertDialog.Builder(getContext())
new AlertDialog.Builder(requireContext())
.setTitle(R.string.share_playlist)
.setMessage(R.string.share_playlist_with_titles_message)
.setCancelable(true)
.setPositiveButton(R.string.share_playlist_with_titles, (dialog, which) -> {
sharePlaylist(/* shouldSharePlaylistDetails= */ true);
})
.setNegativeButton(R.string.share_playlist_with_list, (dialog, which) -> {
sharePlaylist(/* shouldSharePlaylistDetails= */ false);
})
.setPositiveButton(R.string.share_playlist_with_titles, (dialog, which) ->
sharePlaylist(/* shouldSharePlaylistDetails= */ true)
)
.setNegativeButton(R.string.share_playlist_with_list, (dialog, which) ->
sharePlaylist(/* shouldSharePlaylistDetails= */ false)
)
.show();
}
}
Expand Down

0 comments on commit 2e198e6

Please sign in to comment.