Skip to content

Commit be66e8c

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 d84114b commit be66e8c

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
@@ -111,21 +111,6 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
111111
.putExtra(Player.PLAY_WHEN_READY, playWhenReady);
112112
}
113113

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

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

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

0 commit comments

Comments
 (0)