|
5 | 5 | import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase; |
6 | 6 | import static org.schabi.newpipe.util.SparseItemUtil.fetchUploaderUrlIfSparse; |
7 | 7 |
|
| 8 | +import android.content.Context; |
8 | 9 | import android.net.Uri; |
9 | 10 |
|
10 | 11 | import androidx.annotation.NonNull; |
@@ -52,28 +53,33 @@ public enum StreamDialogDefaultEntry { |
52 | 53 | /** |
53 | 54 | * Enqueues the stream automatically to the current PlayerType. |
54 | 55 | */ |
55 | | - ENQUEUE(R.string.enqueue_stream, (fragment, item) -> |
56 | | - fetchItemInfoIfSparse(fragment.requireContext(), item, singlePlayQueue -> |
57 | | - NavigationHelper.enqueueOnPlayer(fragment.getContext(), singlePlayQueue)) |
58 | | - ), |
| 56 | + ENQUEUE(R.string.enqueue_stream, (fragment, item) -> { |
| 57 | + final Context ctx = fragment.requireContext().getApplicationContext(); |
| 58 | + fetchItemInfoIfSparse(ctx, item, singlePlayQueue -> |
| 59 | + NavigationHelper.enqueueOnPlayer(ctx, singlePlayQueue)); |
| 60 | + }), |
59 | 61 |
|
60 | 62 | /** |
61 | 63 | * Enqueues the stream automatically to the current PlayerType |
62 | 64 | * after the currently playing stream. |
63 | 65 | */ |
64 | | - ENQUEUE_NEXT(R.string.enqueue_next_stream, (fragment, item) -> |
65 | | - fetchItemInfoIfSparse(fragment.requireContext(), item, singlePlayQueue -> |
66 | | - NavigationHelper.enqueueNextOnPlayer(fragment.getContext(), singlePlayQueue)) |
67 | | - ), |
| 66 | + ENQUEUE_NEXT(R.string.enqueue_next_stream, (fragment, item) -> { |
| 67 | + final Context ctx = fragment.requireContext().getApplicationContext(); |
| 68 | + fetchItemInfoIfSparse(ctx, item, singlePlayQueue -> |
| 69 | + NavigationHelper.enqueueNextOnPlayer(ctx, singlePlayQueue)); |
| 70 | + }), |
68 | 71 |
|
69 | | - START_HERE_ON_BACKGROUND(R.string.start_here_on_background, (fragment, item) -> |
70 | | - fetchItemInfoIfSparse(fragment.requireContext(), item, singlePlayQueue -> |
71 | | - NavigationHelper.playOnBackgroundPlayer( |
72 | | - fragment.getContext(), singlePlayQueue, true))), |
| 72 | + START_HERE_ON_BACKGROUND(R.string.start_here_on_background, (fragment, item) -> { |
| 73 | + final Context ctx = fragment.requireContext().getApplicationContext(); |
| 74 | + fetchItemInfoIfSparse(ctx, item, singlePlayQueue -> |
| 75 | + NavigationHelper.playOnBackgroundPlayer(ctx, singlePlayQueue, true)); |
| 76 | + }), |
73 | 77 |
|
74 | | - START_HERE_ON_POPUP(R.string.start_here_on_popup, (fragment, item) -> |
75 | | - fetchItemInfoIfSparse(fragment.requireContext(), item, singlePlayQueue -> |
76 | | - NavigationHelper.playOnPopupPlayer(fragment.getContext(), singlePlayQueue, true))), |
| 78 | + START_HERE_ON_POPUP(R.string.start_here_on_popup, (fragment, item) -> { |
| 79 | + final Context ctx = fragment.requireContext().getApplicationContext(); |
| 80 | + fetchItemInfoIfSparse(ctx, item, singlePlayQueue -> |
| 81 | + NavigationHelper.playOnPopupPlayer(ctx, singlePlayQueue, true)); |
| 82 | + }), |
77 | 83 |
|
78 | 84 | SET_AS_PLAYLIST_THUMBNAIL(R.string.set_as_playlist_thumbnail, (fragment, item) -> { |
79 | 85 | throw new UnsupportedOperationException("This needs to be implemented manually " |
|
0 commit comments