Add enqueue option to router dialog

- This allows users to enqueue a stream directly to the current player queue when sharing a link with the app, improving the user experience for queue management.
- The 'Enqueue' option is now available in the action selection dialog and can also be set as the preferred open action in the settings.
This commit is contained in:
Hatake Kakashri 2025-11-19 22:36:54 +05:30 committed by TobiGr
parent 7e46b4565c
commit 54bdb66624
2 changed files with 16 additions and 3 deletions

View file

@ -316,7 +316,8 @@ public class RouterActivity extends AppCompatActivity {
if (choiceChecker.isAvailableAndSelected( if (choiceChecker.isAvailableAndSelected(
R.string.video_player_key, R.string.video_player_key,
R.string.background_player_key, R.string.background_player_key,
R.string.popup_player_key)) { R.string.popup_player_key,
R.string.enqueue_key)) {
final String selectedChoice = choiceChecker.getSelectedChoiceKey(); final String selectedChoice = choiceChecker.getSelectedChoiceKey();
@ -329,6 +330,8 @@ public class RouterActivity extends AppCompatActivity {
|| selectedChoice.equals(getString(R.string.popup_player_key)); || selectedChoice.equals(getString(R.string.popup_player_key));
final boolean isAudioPlayerSelected = final boolean isAudioPlayerSelected =
selectedChoice.equals(getString(R.string.background_player_key)); selectedChoice.equals(getString(R.string.background_player_key));
final boolean isEnqueueSelected =
selectedChoice.equals(getString(R.string.enqueue_key));
if (currentLinkType != LinkType.STREAM if (currentLinkType != LinkType.STREAM
&& ((isExtAudioEnabled && isAudioPlayerSelected) && ((isExtAudioEnabled && isAudioPlayerSelected)
@ -345,7 +348,9 @@ public class RouterActivity extends AppCompatActivity {
// Check if the service supports the choice // Check if the service supports the choice
if ((isVideoPlayerSelected && capabilities.contains(VIDEO)) if ((isVideoPlayerSelected && capabilities.contains(VIDEO))
|| (isAudioPlayerSelected && capabilities.contains(AUDIO))) { || (isAudioPlayerSelected && capabilities.contains(AUDIO))
|| (isEnqueueSelected && (capabilities.contains(VIDEO)
|| capabilities.contains(AUDIO)))) {
handleChoice(selectedChoice); handleChoice(selectedChoice);
} else { } else {
handleChoice(getString(R.string.show_info_key)); handleChoice(getString(R.string.show_info_key));
@ -544,7 +549,10 @@ public class RouterActivity extends AppCompatActivity {
// not be added to a playlist // not be added to a playlist
returnedItems.add(new AdapterChoiceItem(getString(R.string.add_to_playlist_key), returnedItems.add(new AdapterChoiceItem(getString(R.string.add_to_playlist_key),
getString(R.string.add_to_playlist), getString(R.string.add_to_playlist),
R.drawable.ic_add)); R.drawable.ic_playlist_add));
returnedItems.add(new AdapterChoiceItem(getString(R.string.enqueue_key),
getString(R.string.enqueue_stream), R.drawable.ic_add));
} else { } else {
// LinkType.NONE is never present because it's filtered out before // LinkType.NONE is never present because it's filtered out before
// channels and playlist can be played as they contain a list of videos // channels and playlist can be played as they contain a list of videos
@ -1016,6 +1024,8 @@ public class RouterActivity extends AppCompatActivity {
NavigationHelper.playOnBackgroundPlayer(this, playQueue, true); NavigationHelper.playOnBackgroundPlayer(this, playQueue, true);
} else if (choice.playerChoice.equals(popupPlayerKey)) { } else if (choice.playerChoice.equals(popupPlayerKey)) {
NavigationHelper.playOnPopupPlayer(this, playQueue, true); NavigationHelper.playOnPopupPlayer(this, playQueue, true);
} else if (choice.playerChoice.equals(getString(R.string.enqueue_key))) {
NavigationHelper.enqueueOnPlayer(this, playQueue);
} }
}; };
} }

View file

@ -479,6 +479,7 @@
<string name="popup_player_key">popup_player</string> <string name="popup_player_key">popup_player</string>
<string name="download_key">download</string> <string name="download_key">download</string>
<string name="add_to_playlist_key">add_to_playlist</string> <string name="add_to_playlist_key">add_to_playlist</string>
<string name="enqueue_key">enqueue</string>
<string name="always_ask_open_action_key">always_ask_player</string> <string name="always_ask_open_action_key">always_ask_player</string>
<string-array name="preferred_open_action_description_list"> <string-array name="preferred_open_action_description_list">
@ -488,6 +489,7 @@
<item>@string/popup_player</item> <item>@string/popup_player</item>
<item>@string/download</item> <item>@string/download</item>
<item>@string/add_to_playlist</item> <item>@string/add_to_playlist</item>
<item>@string/enqueue_stream</item>
<item>@string/always_ask_open_action</item> <item>@string/always_ask_open_action</item>
</string-array> </string-array>
<string-array name="preferred_open_action_values_list"> <string-array name="preferred_open_action_values_list">
@ -498,6 +500,7 @@
<item>@string/download_key</item> <item>@string/download_key</item>
<item>@string/add_to_playlist_key</item> <item>@string/add_to_playlist_key</item>
<item>@string/always_ask_open_action_key</item> <item>@string/always_ask_open_action_key</item>
<item>@string/enqueue_key</item>
</string-array> </string-array>
<!-- Updates --> <!-- Updates -->