1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-29 05:21:20 +01:00

Move fullscreen-related comments to javadocs

This commit is contained in:
Stypox 2021-08-31 11:28:34 +02:00
parent 3bc661f583
commit ed408b2094
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 21 additions and 8 deletions

View File

@ -1104,9 +1104,14 @@ public final class VideoDetailFragment
}
}
/**
* Opens the video player, in fullscreen if needed. In order to open fullscreen, the activity
* is toggled to landscape orientation (which will then cause fullscreen mode).
*
* @param directlyFullscreenIfApplicable whether to open fullscreen if we are not already
* in landscape and screen orientation is locked
*/
public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
// Toggle to landscape orientation (which will then cause fullscreen mode) if we are not
// already in landscape and screen orientation is locked.
if (directlyFullscreenIfApplicable
&& !DeviceUtils.isLandscape(requireContext())
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
@ -1130,9 +1135,15 @@ public final class VideoDetailFragment
}
}
/**
* If the option to start directly fullscreen is enabled, calls
* {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true}, so that
* if the user is not already in landscape and he has screen orientation locked the activity
* rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen is
* disabled, calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable
* = false}, hence preventing it from going directly fullscreen.
*/
public void openVideoPlayerAutoFullscreen() {
// if the option to start directly fullscreen is enabled, openVideoPlayer will be called
// with directlyFullscreenIfApplicable=true and therefore open fullscreen if applicable
openVideoPlayer(PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext()));
}

View File

@ -747,16 +747,18 @@ public final class Player implements
NavigationHelper.sendPlayerStartedEvent(context);
}
/**
* 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 {@link
* VideoDetailFragment#openVideoPlayer(boolean)} 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.
*/
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();
}
}