@@ -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 intent .putExtra (PlayerService .SHOULD_START_FOREGROUND_EXTRA , true );
10098
10199 return intent ;
@@ -107,17 +105,19 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
107105 @ Nullable final PlayQueue playQueue ,
108106 final boolean resumePlayback ,
109107 final boolean playWhenReady ) {
110- return getPlayerIntent (context , targetClazz , playQueue , resumePlayback )
111- .putExtra (Player .PLAY_WHEN_READY , playWhenReady );
108+ return getPlayerIntent (context , targetClazz , playQueue )
109+ .putExtra (Player .PLAY_WHEN_READY , playWhenReady )
110+ .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
112111 }
113112
114113 @ NonNull
115114 public static <T > Intent getPlayerEnqueueNextIntent (@ NonNull final Context context ,
116115 @ NonNull final Class <T > targetClazz ,
117116 @ Nullable final PlayQueue playQueue ) {
118- // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
119- return getPlayerIntent (context , targetClazz , playQueue , false )
120- .putExtra (Player .ENQUEUE_NEXT , true );
117+ return getPlayerIntent (context , targetClazz , playQueue )
118+ .putExtra (Player .ENQUEUE_NEXT , true )
119+ // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
120+ .putExtra (Player .RESUME_PLAYBACK , false );
121121 }
122122
123123 /* PLAY */
@@ -151,8 +151,9 @@ public static void playOnPopupPlayer(final Context context,
151151
152152 Toast .makeText (context , R .string .popup_playing_toast , Toast .LENGTH_SHORT ).show ();
153153
154- final Intent intent = getPlayerIntent (context , PlayerService .class , queue , resumePlayback );
155- intent .putExtra (Player .PLAYER_TYPE , PlayerType .POPUP .valueForIntent ());
154+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue );
155+ intent .putExtra (Player .PLAYER_TYPE , PlayerType .POPUP .valueForIntent ())
156+ .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
156157 ContextCompat .startForegroundService (context , intent );
157158 }
158159
@@ -162,8 +163,9 @@ public static void playOnBackgroundPlayer(final Context context,
162163 Toast .makeText (context , R .string .background_player_playing_toast , Toast .LENGTH_SHORT )
163164 .show ();
164165
165- final Intent intent = getPlayerIntent (context , PlayerService .class , queue , resumePlayback );
166+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue );
166167 intent .putExtra (Player .PLAYER_TYPE , PlayerType .AUDIO .valueForIntent ());
168+ intent .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
167169 ContextCompat .startForegroundService (context , intent );
168170 }
169171
@@ -176,15 +178,17 @@ public static void enqueueOnPlayer(final Context context,
176178 }
177179
178180 Toast .makeText (context , R .string .enqueued , Toast .LENGTH_SHORT ).show ();
181+
179182 // when enqueueing `resumePlayback` is always `false` since:
180183 // - if there is a video already playing, the value of `resumePlayback` just doesn't make
181184 // any difference.
182185 // - if there is nothing already playing, it is useful for the enqueue action to have a
183186 // slightly different behaviour than the normal play action: the latter resumes playback,
184187 // the former doesn't. (note that enqueue can be triggered when nothing is playing only
185188 // 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 );
189+ final Intent intent = getPlayerIntent (context , PlayerService .class , queue )
190+ .putExtra (Player .ENQUEUE , true )
191+ .putExtra (Player .RESUME_PLAYBACK , false );
188192
189193 intent .putExtra (Player .PLAYER_TYPE , playerType .valueForIntent ());
190194 ContextCompat .startForegroundService (context , intent );
0 commit comments