From c537776826dd0c11a4361cf937f73713882e14ab Mon Sep 17 00:00:00 2001 From: pratyaksh1610 Date: Fri, 9 Dec 2022 14:09:40 +0530 Subject: [PATCH 1/2] 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 From d21fac658b018cf3f06f8ace07ffae67a82a480e Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 31 Dec 2022 23:30:12 +0100 Subject: [PATCH 2/2] Remove playlist details toasts --- .../fragments/list/playlist/PlaylistFragment.java | 13 ++----------- app/src/main/res/values/strings.xml | 1 - 2 files changed, 2 insertions(+), 12 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 899534793..a3150a773 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,7 +13,6 @@ 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; @@ -231,13 +230,8 @@ public class PlaylistFragment extends BaseListInfoFragment dialog.show(getFM(), TAG) )); - } else { - Toast.makeText(getContext(), getString(R.string.playlist_loading_message), - Toast.LENGTH_SHORT).show(); } break; default: diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d72fd4217..76b828746 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -241,7 +241,6 @@ 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