Skip to content

Commit ed408b2

Browse files
committed
Move fullscreen-related comments to javadocs
1 parent 3bc661f commit ed408b2

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,14 @@ private void openPopupPlayer(final boolean append) {
11041104
}
11051105
}
11061106

1107+
/**
1108+
* Opens the video player, in fullscreen if needed. In order to open fullscreen, the activity
1109+
* is toggled to landscape orientation (which will then cause fullscreen mode).
1110+
*
1111+
* @param directlyFullscreenIfApplicable whether to open fullscreen if we are not already
1112+
* in landscape and screen orientation is locked
1113+
*/
11071114
public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
1108-
// Toggle to landscape orientation (which will then cause fullscreen mode) if we are not
1109-
// already in landscape and screen orientation is locked.
11101115
if (directlyFullscreenIfApplicable
11111116
&& !DeviceUtils.isLandscape(requireContext())
11121117
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
@@ -1130,9 +1135,15 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
11301135
}
11311136
}
11321137

1138+
/**
1139+
* If the option to start directly fullscreen is enabled, calls
1140+
* {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true}, so that
1141+
* if the user is not already in landscape and he has screen orientation locked the activity
1142+
* rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen is
1143+
* disabled, calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable
1144+
* = false}, hence preventing it from going directly fullscreen.
1145+
*/
11331146
public void openVideoPlayerAutoFullscreen() {
1134-
// if the option to start directly fullscreen is enabled, openVideoPlayer will be called
1135-
// with directlyFullscreenIfApplicable=true and therefore open fullscreen if applicable
11361147
openVideoPlayer(PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext()));
11371148
}
11381149

app/src/main/java/org/schabi/newpipe/player/Player.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -747,16 +747,18 @@ && isPlaybackResumeEnabled(this)
747747
NavigationHelper.sendPlayerStartedEvent(context);
748748
}
749749

750+
/**
751+
* Open fullscreen on tablets where the option to have the main player start automatically in
752+
* fullscreen mode is on. Rotating the device to landscape is already done in {@link
753+
* VideoDetailFragment#openVideoPlayer(boolean)} when the thumbnail is clicked, and that's
754+
* enough for phones, but not for tablets since the mini player can be also shown in landscape.
755+
*/
750756
private void directlyOpenFullscreenIfNeeded() {
751757
if (fragmentListener != null
752758
&& PlayerHelper.isStartMainPlayerFullscreenEnabled(service)
753759
&& DeviceUtils.isTablet(service)
754760
&& videoPlayerSelected()
755761
&& PlayerHelper.globalScreenOrientationLocked(service)) {
756-
// Open fullscreen on tablets where the option to have the main player start
757-
// automatically in fullscreen mode is on. Rotating the device to landscape is already
758-
// done in VideoDetailFragment when the thumbnail is clicked, and that's enough for
759-
// phones, but not for tablets since the mini player can be also shown in landscape.
760762
fragmentListener.onScreenRotationButtonClicked();
761763
}
762764
}

0 commit comments

Comments
 (0)