From c537776826dd0c11a4361cf937f73713882e14ab Mon Sep 17 00:00:00 2001 From: pratyaksh1610 Date: Fri, 9 Dec 2022 14:09:40 +0530 Subject: [PATCH] Fixes #9518 - Crash fix on clicking on add to playlist. - Added toast when clicked on share button for better UI. --- .../list/playlist/PlaylistFragment.java | 27 ++++++++++++------- app/src/main/res/values/strings.xml | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index e3caeb522..899534793 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -13,6 +13,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -233,21 +234,29 @@ public class PlaylistFragment extends BaseListInfoFragment dialog.show(getFM(), TAG) - )); + if (currentInfo != null) { + disposables.add(PlaylistDialog.createCorrespondingDialog( + getContext(), + getPlayQueue() + .getStreams() + .stream() + .map(StreamEntity::new) + .collect(Collectors.toList()), + dialog -> dialog.show(getFM(), TAG) + )); + } else { + Toast.makeText(getContext(), getString(R.string.playlist_loading_message), + Toast.LENGTH_SHORT).show(); + } break; default: return super.onOptionsItemSelected(item); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 76b828746..d72fd4217 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -241,6 +241,7 @@ Restore defaults Do you want to restore defaults? Give permission to display over other apps + Playlist loading… NewPipe encountered an error, tap to report An error occurred, see the notification