Revert "Remember and restore orientation on fullscreen exit"

This commit is contained in:
Stypox 2026-01-28 01:44:39 +01:00 committed by GitHub
parent 4e0d542994
commit 49e95d95a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -206,8 +206,6 @@ public final class VideoDetailFragment
int lastStableBottomSheetState = BottomSheetBehavior.STATE_EXPANDED; int lastStableBottomSheetState = BottomSheetBehavior.STATE_EXPANDED;
@State @State
protected boolean autoPlayEnabled = true; protected boolean autoPlayEnabled = true;
@State
protected int originalOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@Nullable @Nullable
private StreamInfo currentInfo = null; private StreamInfo currentInfo = null;
@ -1908,29 +1906,23 @@ public final class VideoDetailFragment
@Override @Override
public void onScreenRotationButtonClicked() { public void onScreenRotationButtonClicked() {
final Optional<MainPlayerUi> playerUi = player != null // On Android TV screen rotation is not supported
? player.UIs().get(MainPlayerUi.class) // In tablet user experience will be better if screen will not be rotated
: Optional.empty(); // from landscape to portrait every time.
if (playerUi.isEmpty()) { // Just turn on fullscreen mode in landscape orientation
// or portrait & unlocked global orientation
final boolean isLandscape = DeviceUtils.isLandscape(requireContext());
if (DeviceUtils.isTv(activity) || DeviceUtils.isTablet(activity)
&& (!globalScreenOrientationLocked(activity) || isLandscape)) {
player.UIs().get(MainPlayerUi.class).ifPresent(MainPlayerUi::toggleFullscreen);
return; return;
} }
// On tablets and TVs, just toggle fullscreen UI without orientation change. final int newOrientation = isLandscape
if (DeviceUtils.isTablet(activity) || DeviceUtils.isTv(activity)) { ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
playerUi.get().toggleFullscreen(); : ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
return;
}
if (playerUi.get().isFullscreen()) { activity.setRequestedOrientation(newOrientation);
// EXITING FULLSCREEN
playerUi.get().toggleFullscreen();
activity.setRequestedOrientation(originalOrientation);
} else {
// ENTERING FULLSCREEN
originalOrientation = activity.getRequestedOrientation();
playerUi.get().toggleFullscreen();
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
} }
/* /*