Skip to content

Commit 1da9bba

Browse files
committed
NavigationHelper: inline getPlayerEnqueueIntent
Funnily enough, I’m pretty sure that whole comment will be not necessary, because we never check `resumePlayback` on handling the intent anyway.
1 parent 2277874 commit 1da9bba

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,6 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
110110
.putExtra(Player.PLAY_WHEN_READY, playWhenReady);
111111
}
112112

113-
@NonNull
114-
public static <T> Intent getPlayerEnqueueIntent(@NonNull final Context context,
115-
@NonNull final Class<T> targetClazz,
116-
@Nullable final PlayQueue playQueue) {
117-
// when enqueueing `resumePlayback` is always `false` since:
118-
// - if there is a video already playing, the value of `resumePlayback` just doesn't make
119-
// any difference.
120-
// - if there is nothing already playing, it is useful for the enqueue action to have a
121-
// slightly different behaviour than the normal play action: the latter resumes playback,
122-
// the former doesn't. (note that enqueue can be triggered when nothing is playing only
123-
// by long pressing the video detail fragment, playlist or channel controls
124-
return getPlayerIntent(context, targetClazz, playQueue, false)
125-
.putExtra(Player.ENQUEUE, true);
126-
}
127-
128113
@NonNull
129114
public static <T> Intent getPlayerEnqueueNextIntent(@NonNull final Context context,
130115
@NonNull final Class<T> targetClazz,
@@ -190,7 +175,15 @@ public static void enqueueOnPlayer(final Context context,
190175
}
191176

192177
Toast.makeText(context, R.string.enqueued, Toast.LENGTH_SHORT).show();
193-
final Intent intent = getPlayerEnqueueIntent(context, PlayerService.class, queue);
178+
// when enqueueing `resumePlayback` is always `false` since:
179+
// - if there is a video already playing, the value of `resumePlayback` just doesn't make
180+
// any difference.
181+
// - if there is nothing already playing, it is useful for the enqueue action to have a
182+
// slightly different behaviour than the normal play action: the latter resumes playback,
183+
// the former doesn't. (note that enqueue can be triggered when nothing is playing only
184+
// by long pressing the video detail fragment, playlist or channel controls
185+
final Intent intent = getPlayerIntent(context, PlayerService.class, queue, false)
186+
.putExtra(Player.ENQUEUE, true);
194187

195188
intent.putExtra(Player.PLAYER_TYPE, playerType.valueForIntent());
196189
ContextCompat.startForegroundService(context, intent);

0 commit comments

Comments
 (0)