Remove TAG parameter, refactor method calls

This commit is contained in:
ktprograms 2021-08-25 17:04:15 +08:00
parent a1cb3e59d6
commit a4503eb609
3 changed files with 8 additions and 22 deletions

View file

@ -23,8 +23,7 @@ public final class QueueItemMenuUtil {
final View view, final View view,
final boolean hideDetails, final boolean hideDetails,
final FragmentManager fragmentManager, final FragmentManager fragmentManager,
final Context context, final Context context) {
final String tag) {
final ContextThemeWrapper themeWrapper = final ContextThemeWrapper themeWrapper =
new ContextThemeWrapper(context, R.style.DarkPopupMenu); new ContextThemeWrapper(context, R.style.DarkPopupMenu);
@ -52,9 +51,9 @@ public final class QueueItemMenuUtil {
Collections.singletonList(item) Collections.singletonList(item)
); );
PlaylistAppendDialog.onPlaylistFound(context, PlaylistAppendDialog.onPlaylistFound(context,
() -> d.show(fragmentManager, tag), () -> d.show(fragmentManager, "QueueItemMenuUtil@append_playlist"),
() -> PlaylistCreationDialog.newInstance(d) () -> PlaylistCreationDialog.newInstance(d)
.show(fragmentManager, tag)); .show(fragmentManager, "QueueItemMenuUtil@append_playlist"));
return true; return true;
case R.id.menu_item_share: case R.id.menu_item_share:
shareText(context, item.getTitle(), item.getUrl(), shareText(context, item.getTitle(), item.getUrl(),

View file

@ -276,11 +276,6 @@ public final class PlayQueueActivity extends AppCompatActivity
queueControlBinding.controlShuffle.setOnClickListener(this); queueControlBinding.controlShuffle.setOnClickListener(this);
} }
private void buildItemPopupMenu(final PlayQueueItem item, final View view) {
openPopupMenu(player.getPlayQueue(), item, view, false,
getSupportFragmentManager(), this, TAG);
}
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Component Helpers // Component Helpers
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@ -328,13 +323,9 @@ public final class PlayQueueActivity extends AppCompatActivity
@Override @Override
public void held(final PlayQueueItem item, final View view) { public void held(final PlayQueueItem item, final View view) {
if (player == null) { if (player != null && player.getPlayQueue().indexOf(item) != -1) {
return; openPopupMenu(player.getPlayQueue(), item, view, false,
} getSupportFragmentManager(), PlayQueueActivity.this);
final int index = player.getPlayQueue().indexOf(item);
if (index != -1) {
buildItemPopupMenu(item, view);
} }
} }

View file

@ -3033,11 +3033,6 @@ public final class Player implements
playQueue.setIndex(index); playQueue.setIndex(index);
} }
private void heldQueueItem(final PlayQueueItem item, final View view) {
openPopupMenu(playQueue, item, view, true,
getParentActivity().getSupportFragmentManager(), context, TAG);
}
@Override @Override
public void onPlayQueueEdited() { public void onPlayQueueEdited() {
notifyPlaybackUpdateToListeners(); notifyPlaybackUpdateToListeners();
@ -3205,7 +3200,8 @@ public final class Player implements
@Override @Override
public void held(final PlayQueueItem item, final View view) { public void held(final PlayQueueItem item, final View view) {
if (playQueue.indexOf(item) != -1) { if (playQueue.indexOf(item) != -1) {
heldQueueItem(item, view); openPopupMenu(playQueue, item, view, true,
getParentActivity().getSupportFragmentManager(), context);
} }
} }