@@ -84,8 +84,7 @@ private NavigationHelper() {
8484 @ NonNull
8585 public static <T > Intent getPlayerIntent (@ NonNull final Context context ,
8686 @ NonNull final Class <T > targetClazz ,
87- @ Nullable final PlayQueue playQueue ,
88- final boolean resumePlayback ) {
87+ @ Nullable final PlayQueue playQueue ) {
8988 final Intent intent = new Intent (context , targetClazz );
9089
9190 if (playQueue != null ) {
@@ -95,7 +94,6 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
9594 }
9695 }
9796 intent .putExtra (Player .PLAYER_TYPE , PlayerType .MAIN .valueForIntent ());
98- intent .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
9997
10098 return intent ;
10199 }
@@ -106,17 +104,19 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
106104 @ Nullable final PlayQueue playQueue ,
107105 final boolean resumePlayback ,
108106 final boolean playWhenReady ) {
109- return getPlayerIntent (context , targetClazz , playQueue , resumePlayback )
110- .putExtra (Player .PLAY_WHEN_READY , playWhenReady );
107+ return getPlayerIntent (context , targetClazz , playQueue )
108+ .putExtra (Player .PLAY_WHEN_READY , playWhenReady )
109+ .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
111110 }
112111
113112 @ NonNull
114113 public static <T > Intent getPlayerEnqueueNextIntent (@ NonNull final Context context ,
115114 @ NonNull final Class <T > targetClazz ,
116115 @ Nullable final PlayQueue playQueue ) {
117- // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
118- return getPlayerIntent (context , targetClazz , playQueue , false )
119- .putExtra (Player .ENQUEUE_NEXT , true );
116+ return getPlayerIntent (context , targetClazz , playQueue )
117+ .putExtra (Player .ENQUEUE_NEXT , true )
118+ // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
119+ .putExtra (Player .RESUME_PLAYBACK , false );
120120 }
121121
122122 /* PLAY */
@@ -150,8 +150,9 @@ public static void playOnPopupPlayer(final Context context,
150150
151151 Toast .makeText (context , R .string .popup_playing_toast , Toast .LENGTH_SHORT ).show ();
152152
153- final Intent intent = getPlayerIntent (context , PlayerService .class , queue , resumePlayback );
154- intent .putExtra (Player .PLAYER_TYPE , PlayerType .POPUP .valueForIntent ());
153+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue );
154+ intent .putExtra (Player .PLAYER_TYPE , PlayerType .POPUP .valueForIntent ())
155+ .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
155156 ContextCompat .startForegroundService (context , intent );
156157 }
157158
@@ -161,8 +162,9 @@ public static void playOnBackgroundPlayer(final Context context,
161162 Toast .makeText (context , R .string .background_player_playing_toast , Toast .LENGTH_SHORT )
162163 .show ();
163164
164- final Intent intent = getPlayerIntent (context , PlayerService .class , queue , resumePlayback );
165+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue );
165166 intent .putExtra (Player .PLAYER_TYPE , PlayerType .AUDIO .valueForIntent ());
167+ intent .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
166168 ContextCompat .startForegroundService (context , intent );
167169 }
168170
@@ -175,15 +177,17 @@ public static void enqueueOnPlayer(final Context context,
175177 }
176178
177179 Toast .makeText (context , R .string .enqueued , Toast .LENGTH_SHORT ).show ();
180+
178181 // when enqueueing `resumePlayback` is always `false` since:
179182 // - if there is a video already playing, the value of `resumePlayback` just doesn't make
180183 // any difference.
181184 // - if there is nothing already playing, it is useful for the enqueue action to have a
182185 // slightly different behaviour than the normal play action: the latter resumes playback,
183186 // the former doesn't. (note that enqueue can be triggered when nothing is playing only
184187 // 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 );
188+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue )
189+ .putExtra (Player .ENQUEUE , true )
190+ .putExtra (Player .RESUME_PLAYBACK , false );
187191
188192 intent .putExtra (Player .PLAYER_TYPE , playerType .valueForIntent ());
189193 ContextCompat .startForegroundService (context , intent );
0 commit comments