Fix opening directly fullscreen on tablets

This commit is contained in:
Stypox 2021-03-28 12:03:33 +02:00
parent 2dfe837c35
commit c6316abbce
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
3 changed files with 19 additions and 10 deletions

View file

@ -621,6 +621,9 @@ public final class Player implements
return;
}
// needed for tablets, check the function for a better explanation
directlyOpenFullscreenIfNeeded();
final PlaybackParameters savedParameters = retrievePlaybackParametersFromPrefs(this);
final float playbackSpeed = savedParameters.speed;
final float playbackPitch = savedParameters.pitch;
@ -743,6 +746,20 @@ public final class Player implements
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,
@RepeatMode final int repeatMode,
final float playbackSpeed,