@@ -293,8 +293,8 @@ protected void onSuccess() {
293293 selectedChoice .equals (getString (R .string .background_player_key ));
294294
295295 if (currentLinkType != LinkType .STREAM
296- && (isExtAudioEnabled && isAudioPlayerSelected
297- || isExtVideoEnabled && isVideoPlayerSelected )
296+ && (( isExtAudioEnabled && isAudioPlayerSelected )
297+ || ( isExtVideoEnabled && isVideoPlayerSelected ) )
298298 ) {
299299 Toast .makeText (this , R .string .external_player_unsupported_link_type ,
300300 Toast .LENGTH_LONG ).show ();
@@ -306,8 +306,8 @@ protected void onSuccess() {
306306 currentService .getServiceInfo ().getMediaCapabilities ();
307307
308308 // Check if the service supports the choice
309- if (isVideoPlayerSelected && capabilities .contains (VIDEO )
310- || isAudioPlayerSelected && capabilities .contains (AUDIO )) {
309+ if (( isVideoPlayerSelected && capabilities .contains (VIDEO ) )
310+ || ( isAudioPlayerSelected && capabilities .contains (AUDIO ) )) {
311311 handleChoice (selectedChoice );
312312 } else {
313313 handleChoice (getString (R .string .show_info_key ));
@@ -483,6 +483,7 @@ private List<AdapterChoiceItem> getChoicesForService(final StreamingService serv
483483
484484 final List <AdapterChoiceItem > returnedItems = new ArrayList <>();
485485 returnedItems .add (showInfo ); // Always present
486+
486487 final List <StreamingService .ServiceInfo .MediaCapability > capabilities =
487488 service .getServiceInfo ().getMediaCapabilities ();
488489
@@ -506,6 +507,8 @@ private List<AdapterChoiceItem> getChoicesForService(final StreamingService serv
506507 getString (R .string .add_to_playlist ),
507508 R .drawable .ic_add ));
508509 } else {
510+ // LinkType.NONE is never present because it's filtered out before
511+ // channels and playlist can be played as they contain a list of videos
509512 final SharedPreferences preferences = PreferenceManager
510513 .getDefaultSharedPreferences (this );
511514 final boolean isExtVideoEnabled = preferences .getBoolean (
@@ -608,30 +611,28 @@ private void handleChoice(final String selectedChoiceKey) {
608611 finish ();
609612 }
610613
611- // show only "video player" since the details activity will be opened and the
612- // video will be auto played there.
613614 private boolean canHandleChoiceLikeShowInfo (final String selectedChoiceKey ) {
614- // "video player" can be handled like "show info" when...
615- if (selectedChoiceKey .equals (getString (R .string .video_player_key ))) {
616- // Autoplay is enabled
617- if (!PlayerHelper .isAutoplayAllowedByUser (getThemeWrapperContext ())) {
618- return false ;
619- }
615+ if (!selectedChoiceKey .equals (getString (R .string .video_player_key ))) {
616+ return false ;
617+ }
618+ // "video player" can be handled like "show info" (because VideoDetailFragment can load
619+ // the stream instead of FetcherService) when...
620620
621- final boolean isExtVideoEnabled = PreferenceManager .getDefaultSharedPreferences (this )
622- .getBoolean (getString (R .string .use_external_video_player_key ), false );
623- // Ignore it when it's done via an external player
624- if (isExtVideoEnabled ) {
625- return false ;
626- }
621+ // ...Autoplay is enabled
622+ if (!PlayerHelper .isAutoplayAllowedByUser (getThemeWrapperContext ())) {
623+ return false ;
624+ }
627625
628- // The player is not running or in Video-mode/type
629- final MainPlayer . PlayerType playerType = PlayerHolder . getInstance (). getType ( );
630- return playerType == null || playerType == MainPlayer . PlayerType . VIDEO ;
631- // Since "show info" would do the exact same thing, use that as a key to let
632- // VideoDetailFragment load the stream instead of using FetcherService
626+ final boolean isExtVideoEnabled = PreferenceManager . getDefaultSharedPreferences ( this )
627+ . getBoolean ( getString ( R . string . use_external_video_player_key ), false );
628+ // ...it's not done via an external player
629+ if ( isExtVideoEnabled ) {
630+ return false ;
633631 }
634- return false ;
632+
633+ // ...the player is not running or in normal Video-mode/type
634+ final MainPlayer .PlayerType playerType = PlayerHolder .getInstance ().getType ();
635+ return playerType == null || playerType == MainPlayer .PlayerType .VIDEO ;
635636 }
636637
637638 private void openAddToPlaylistDialog () {
0 commit comments