Open fullscreen when switching from popup to main player

This commit is contained in:
Stypox 2021-07-27 11:02:32 +02:00
parent 520ac2e935
commit 1d935b46f9
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 14 additions and 5 deletions

View File

@ -241,7 +241,7 @@ public final class VideoDetailFragment
&& isAutoplayEnabled()
&& player.getParentActivity() == null)) {
autoPlayEnabled = true; // forcefully start playing
openVideoPlayer(true);
openVideoPlayerAutoFullscreen();
}
}
@ -499,7 +499,7 @@ public final class VideoDetailFragment
break;
case R.id.detail_thumbnail_root_layout:
autoPlayEnabled = true; // forcefully start playing
openVideoPlayer(true);
openVideoPlayerAutoFullscreen();
break;
case R.id.detail_title_root_layout:
toggleTitleAndSecondaryControls();
@ -899,7 +899,7 @@ public final class VideoDetailFragment
}
if (isAutoplayEnabled()) {
openVideoPlayer(true);
openVideoPlayerAutoFullscreen();
}
}
}, throwable -> showError(new ErrorInfo(throwable, UserAction.REQUESTED_STREAM,
@ -1105,8 +1105,9 @@ public final class VideoDetailFragment
}
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
&& PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())
&& !DeviceUtils.isLandscape(requireContext())
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
// Make sure the bottom sheet turns out expanded. When this code kicks in the bottom
@ -1129,6 +1130,12 @@ public final class VideoDetailFragment
}
}
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()));
}
private void openNormalBackgroundPlayer(final boolean append) {
// See UI changes while remote playQueue changes
if (!isPlayerAvailable()) {

View File

@ -366,7 +366,9 @@ public final class NavigationHelper {
if (switchingPlayers) {
// Situation when user switches from players to main player. All needed data is
// here, we can start watching (assuming newQueue equals playQueue).
detailFragment.openVideoPlayer(true);
// Starting directly in fullscreen if the previous player type was popup.
detailFragment.openVideoPlayer(playerType == MainPlayer.PlayerType.POPUP
|| PlayerHelper.isStartMainPlayerFullscreenEnabled(context));
} else {
detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue);
}