Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,13 @@ public void onClick(View v) {
}
});

playButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
FullDetailsFragmentHelperKt.forceExternalPlayerPopup(FullDetailsFragment.this, view, mBaseItem);
return true;
}
});
mDetailsOverviewRow.addAction(playButton);

if (resumeButtonVisible) {
Expand Down Expand Up @@ -1194,6 +1201,10 @@ void shufflePlay() {
}

void play(final BaseItemDto item, final int pos, final boolean shuffle) {
play(item, pos, shuffle, false);
}

void play(final BaseItemDto item, final int pos, final boolean shuffle, final boolean forceExternalPlayer) {
playbackHelper.getValue().getItemsToPlay(getContext(), item, pos == 0 && item.getType() == BaseItemKind.MOVIE, shuffle, new Response<List<BaseItemDto>>() {
@Override
public void onResponse(List<BaseItemDto> response) {
Expand All @@ -1206,7 +1217,9 @@ public void onResponse(List<BaseItemDto> response) {
mediaManager.getValue().playNow(requireContext(), response, 0, shuffle);
} else {
videoQueueManager.getValue().setCurrentVideoQueue(response);
Destination destination = KoinJavaComponent.<PlaybackLauncher>get(PlaybackLauncher.class).getPlaybackDestination(item.getType(), pos);
Destination destination = forceExternalPlayer
? KoinJavaComponent.<PlaybackLauncher>get(PlaybackLauncher.class).getExternalPlayer(item.getType(), pos)
: KoinJavaComponent.<PlaybackLauncher>get(PlaybackLauncher.class).getPlaybackDestination(item.getType(), pos);
navigationRepository.getValue().navigate(destination);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ fun FullDetailsFragment.showDetailsMenu(
}
}.showIfNotEmpty()

fun FullDetailsFragment.forceExternalPlayerPopup(
view: View,
mBaseItem: BaseItemDto,
) = popupMenu(requireContext(), view) {
item(getString(R.string.pref_external_player)) {
play(mBaseItem, 0, false, true)
}
}.show()

fun FullDetailsFragment.createFakeSeriesTimerBaseItemDto(timer: SeriesTimerInfoDto) = BaseItemDto(
id = requireNotNull(timer.id).toUUID(),
type = BaseItemKind.FOLDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import kotlin.time.Duration.Companion.milliseconds
interface PlaybackLauncher {
fun useExternalPlayer(itemType: BaseItemKind?): Boolean
fun getPlaybackDestination(itemType: BaseItemKind?, position: Int): Destination
fun getExternalPlayer(itemType: BaseItemKind?, position: Int): Destination
}

class GarbagePlaybackLauncher(
Expand All @@ -28,6 +29,9 @@ class GarbagePlaybackLauncher(
else -> false
}

override fun getExternalPlayer(itemType: BaseItemKind?, position: Int): Destination =
Destinations.externalPlayer(position.milliseconds)

override fun getPlaybackDestination(itemType: BaseItemKind?, position: Int) = when {
useExternalPlayer(itemType) -> Destinations.externalPlayer(position.milliseconds)
else -> Destinations.videoPlayer(position)
Expand All @@ -37,4 +41,5 @@ class GarbagePlaybackLauncher(
class RewritePlaybackLauncher : PlaybackLauncher {
override fun useExternalPlayer(itemType: BaseItemKind?) = false
override fun getPlaybackDestination(itemType: BaseItemKind?, position: Int) = Destinations.playbackRewritePlayer(position)
override fun getExternalPlayer(itemType: BaseItemKind?, position: Int) = Destinations.playbackRewritePlayer(position)
}