mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Fix opening directly fullscreen on tablets
This commit is contained in:
parent
2dfe837c35
commit
c6316abbce
@ -1109,7 +1109,7 @@ public final class VideoDetailFragment
|
|||||||
&& PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())
|
&& PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())
|
||||||
&& !DeviceUtils.isLandscape(requireContext())
|
&& !DeviceUtils.isLandscape(requireContext())
|
||||||
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
|
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
|
||||||
// open directly in fullscreen TODO does it work for large-land layouts?
|
// toggle landscape in order to open directly in fullscreen
|
||||||
onScreenRotationButtonClicked();
|
onScreenRotationButtonClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,6 +621,9 @@ public final class Player implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needed for tablets, check the function for a better explanation
|
||||||
|
directlyOpenFullscreenIfNeeded();
|
||||||
|
|
||||||
final PlaybackParameters savedParameters = retrievePlaybackParametersFromPrefs(this);
|
final PlaybackParameters savedParameters = retrievePlaybackParametersFromPrefs(this);
|
||||||
final float playbackSpeed = savedParameters.speed;
|
final float playbackSpeed = savedParameters.speed;
|
||||||
final float playbackPitch = savedParameters.pitch;
|
final float playbackPitch = savedParameters.pitch;
|
||||||
@ -743,6 +746,20 @@ public final class Player implements
|
|||||||
NavigationHelper.sendPlayerStartedEvent(context);
|
NavigationHelper.sendPlayerStartedEvent(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void directlyOpenFullscreenIfNeeded() {
|
||||||
|
if (fragmentListener != null
|
||||||
|
&& PlayerHelper.isStartMainPlayerFullscreenEnabled(service)
|
||||||
|
&& DeviceUtils.isTablet(service)
|
||||||
|
&& videoPlayerSelected()
|
||||||
|
&& PlayerHelper.globalScreenOrientationLocked(service)) {
|
||||||
|
// Open fullscreen on tablets where the option to have the main player start
|
||||||
|
// automatically in fullscreen mode is on. Rotating the device to landscape is already
|
||||||
|
// done in VideoDetailFragment when the thumbnail is clicked, and that's enough for
|
||||||
|
// phones, but not for tablets since the mini player can be also shown in landscape.
|
||||||
|
fragmentListener.onScreenRotationButtonClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initPlayback(@NonNull final PlayQueue queue,
|
private void initPlayback(@NonNull final PlayQueue queue,
|
||||||
@RepeatMode final int repeatMode,
|
@RepeatMode final int repeatMode,
|
||||||
final float playbackSpeed,
|
final float playbackSpeed,
|
||||||
|
@ -366,15 +366,7 @@ public final class NavigationHelper {
|
|||||||
if (switchingPlayers) {
|
if (switchingPlayers) {
|
||||||
// Situation when user switches from players to main player. All needed data is
|
// Situation when user switches from players to main player. All needed data is
|
||||||
// here, we can start watching (assuming newQueue equals playQueue).
|
// here, we can start watching (assuming newQueue equals playQueue).
|
||||||
|
detailFragment.openVideoPlayer(true);
|
||||||
// Starting directly in fullscreen if the previous player type was popup.
|
|
||||||
if (playerType == MainPlayer.PlayerType.POPUP
|
|
||||||
&& !DeviceUtils.isLandscape(context)
|
|
||||||
&& PlayerHelper.globalScreenOrientationLocked(context)) {
|
|
||||||
detailFragment.onScreenRotationButtonClicked();
|
|
||||||
}
|
|
||||||
// pass false to directlyFullscreenIfApplicable since that's handled just above here
|
|
||||||
detailFragment.openVideoPlayer(false);
|
|
||||||
} else {
|
} else {
|
||||||
detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue);
|
detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user