mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
Fix add to playlist
This commit is contained in:
parent
1daece3bee
commit
733f6aae85
@ -264,15 +264,10 @@ public class RouterActivity extends AppCompatActivity {
|
|||||||
getString(R.string.preferred_open_action_default));
|
getString(R.string.preferred_open_action_default));
|
||||||
|
|
||||||
final String showInfoKey = getString(R.string.show_info_key);
|
final String showInfoKey = getString(R.string.show_info_key);
|
||||||
final String videoPlayerKey = getString(R.string.video_player_key);
|
|
||||||
final String backgroundPlayerKey = getString(R.string.background_player_key);
|
|
||||||
final String popupPlayerKey = getString(R.string.popup_player_key);
|
|
||||||
final String downloadKey = getString(R.string.download_key);
|
|
||||||
final String alwaysAskKey = getString(R.string.always_ask_open_action_key);
|
|
||||||
|
|
||||||
if (selectedChoiceKey.equals(alwaysAskKey)) {
|
if (selectedChoiceKey.equals(getString(R.string.always_ask_open_action_key))) {
|
||||||
final List<AdapterChoiceItem> choices
|
final List<AdapterChoiceItem> choices =
|
||||||
= getChoicesForService(currentService, currentLinkType);
|
getChoicesForService(currentService, currentLinkType);
|
||||||
|
|
||||||
switch (choices.size()) {
|
switch (choices.size()) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -285,36 +280,39 @@ public class RouterActivity extends AppCompatActivity {
|
|||||||
showDialog(choices);
|
showDialog(choices);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (selectedChoiceKey.equals(showInfoKey)) {
|
} else if (selectedChoiceKey.equals(showInfoKey)
|
||||||
handleChoice(showInfoKey);
|
|| selectedChoiceKey.equals(getString(R.string.download_key))
|
||||||
} else if (selectedChoiceKey.equals(downloadKey)) {
|
|| selectedChoiceKey.equals(getString(R.string.add_to_playlist_key))
|
||||||
handleChoice(downloadKey);
|
) {
|
||||||
|
handleChoice(selectedChoiceKey);
|
||||||
} else {
|
} else {
|
||||||
final boolean isExtVideoEnabled = preferences.getBoolean(
|
final boolean isExtVideoEnabled = preferences.getBoolean(
|
||||||
getString(R.string.use_external_video_player_key), false);
|
getString(R.string.use_external_video_player_key), false);
|
||||||
final boolean isExtAudioEnabled = preferences.getBoolean(
|
final boolean isExtAudioEnabled = preferences.getBoolean(
|
||||||
getString(R.string.use_external_audio_player_key), false);
|
getString(R.string.use_external_audio_player_key), false);
|
||||||
final boolean isVideoPlayerSelected = selectedChoiceKey.equals(videoPlayerKey)
|
final boolean isVideoPlayerSelected =
|
||||||
|| selectedChoiceKey.equals(popupPlayerKey);
|
selectedChoiceKey.equals(getString(R.string.video_player_key))
|
||||||
final boolean isAudioPlayerSelected = selectedChoiceKey.equals(backgroundPlayerKey);
|
|| selectedChoiceKey.equals(getString(R.string.popup_player_key));
|
||||||
|
final boolean isAudioPlayerSelected =
|
||||||
|
selectedChoiceKey.equals(getString(R.string.background_player_key));
|
||||||
|
|
||||||
if (currentLinkType != LinkType.STREAM) {
|
if (currentLinkType != LinkType.STREAM
|
||||||
if (isExtAudioEnabled && isAudioPlayerSelected
|
&& (isExtAudioEnabled && isAudioPlayerSelected
|
||||||
|| isExtVideoEnabled && isVideoPlayerSelected) {
|
|| isExtVideoEnabled && isVideoPlayerSelected)
|
||||||
|
) {
|
||||||
Toast.makeText(this, R.string.external_player_unsupported_link_type,
|
Toast.makeText(this, R.string.external_player_unsupported_link_type,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
handleChoice(showInfoKey);
|
handleChoice(showInfoKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final List<StreamingService.ServiceInfo.MediaCapability> capabilities
|
final List<StreamingService.ServiceInfo.MediaCapability> capabilities =
|
||||||
= currentService.getServiceInfo().getMediaCapabilities();
|
currentService.getServiceInfo().getMediaCapabilities();
|
||||||
|
|
||||||
boolean serviceSupportsChoice = false;
|
boolean serviceSupportsChoice = false;
|
||||||
if (isVideoPlayerSelected) {
|
if (isVideoPlayerSelected) {
|
||||||
serviceSupportsChoice = capabilities.contains(VIDEO);
|
serviceSupportsChoice = capabilities.contains(VIDEO);
|
||||||
} else if (selectedChoiceKey.equals(backgroundPlayerKey)) {
|
} else if (isAudioPlayerSelected) {
|
||||||
serviceSupportsChoice = capabilities.contains(AUDIO);
|
serviceSupportsChoice = capabilities.contains(AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user