From a4503eb6092d76c54c66edfb4a41719561e9ca9a Mon Sep 17 00:00:00 2001 From: ktprograms Date: Wed, 25 Aug 2021 17:04:15 +0800 Subject: [PATCH] Remove TAG parameter, refactor method calls --- .../org/schabi/newpipe/QueueItemMenuUtil.java | 7 +++---- .../schabi/newpipe/player/PlayQueueActivity.java | 15 +++------------ .../java/org/schabi/newpipe/player/Player.java | 8 ++------ 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java b/app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java index ede4fa782..9105ff992 100644 --- a/app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java +++ b/app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java @@ -23,8 +23,7 @@ public final class QueueItemMenuUtil { final View view, final boolean hideDetails, final FragmentManager fragmentManager, - final Context context, - final String tag) { + final Context context) { final ContextThemeWrapper themeWrapper = new ContextThemeWrapper(context, R.style.DarkPopupMenu); @@ -52,9 +51,9 @@ public final class QueueItemMenuUtil { Collections.singletonList(item) ); PlaylistAppendDialog.onPlaylistFound(context, - () -> d.show(fragmentManager, tag), + () -> d.show(fragmentManager, "QueueItemMenuUtil@append_playlist"), () -> PlaylistCreationDialog.newInstance(d) - .show(fragmentManager, tag)); + .show(fragmentManager, "QueueItemMenuUtil@append_playlist")); return true; case R.id.menu_item_share: shareText(context, item.getTitle(), item.getUrl(), diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java index 7057b688d..0976aa4fb 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java @@ -276,11 +276,6 @@ public final class PlayQueueActivity extends AppCompatActivity queueControlBinding.controlShuffle.setOnClickListener(this); } - private void buildItemPopupMenu(final PlayQueueItem item, final View view) { - openPopupMenu(player.getPlayQueue(), item, view, false, - getSupportFragmentManager(), this, TAG); - } - //////////////////////////////////////////////////////////////////////////// // Component Helpers //////////////////////////////////////////////////////////////////////////// @@ -328,13 +323,9 @@ public final class PlayQueueActivity extends AppCompatActivity @Override public void held(final PlayQueueItem item, final View view) { - if (player == null) { - return; - } - - final int index = player.getPlayQueue().indexOf(item); - if (index != -1) { - buildItemPopupMenu(item, view); + if (player != null && player.getPlayQueue().indexOf(item) != -1) { + openPopupMenu(player.getPlayQueue(), item, view, false, + getSupportFragmentManager(), PlayQueueActivity.this); } } diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 53a4c12db..892ea6529 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3033,11 +3033,6 @@ public final class Player implements playQueue.setIndex(index); } - private void heldQueueItem(final PlayQueueItem item, final View view) { - openPopupMenu(playQueue, item, view, true, - getParentActivity().getSupportFragmentManager(), context, TAG); - } - @Override public void onPlayQueueEdited() { notifyPlaybackUpdateToListeners(); @@ -3205,7 +3200,8 @@ public final class Player implements @Override public void held(final PlayQueueItem item, final View view) { if (playQueue.indexOf(item) != -1) { - heldQueueItem(item, view); + openPopupMenu(playQueue, item, view, true, + getParentActivity().getSupportFragmentManager(), context); } }