feat(android): set originalFitsSystemWindows on fullscreen open (#4013)

This commit is contained in:
Igor Malgrab 2024-07-17 12:29:38 +02:00 committed by GitHub
parent 7611da155f
commit 2f70c02cdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -202,6 +202,7 @@ public class ReactExoplayerView extends FrameLayout implements
private long resumePosition; private long resumePosition;
private boolean loadVideoStarted; private boolean loadVideoStarted;
private boolean isFullscreen; private boolean isFullscreen;
private boolean originalFitsSystemWindows;
private boolean isInBackground; private boolean isInBackground;
private boolean isPaused; private boolean isPaused;
private boolean isBuffering; private boolean isBuffering;
@ -2238,6 +2239,7 @@ public class ReactExoplayerView extends FrameLayout implements
fullScreenPlayerView.show(); fullScreenPlayerView.show();
} }
UiThreadUtil.runOnUiThread(() -> { UiThreadUtil.runOnUiThread(() -> {
originalFitsSystemWindows = window.getDecorView().getFitsSystemWindows();
WindowCompat.setDecorFitsSystemWindows(window, false); WindowCompat.setDecorFitsSystemWindows(window, false);
controller.hide(WindowInsetsCompat.Type.systemBars()); controller.hide(WindowInsetsCompat.Type.systemBars());
controller.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE); controller.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
@ -2251,7 +2253,7 @@ public class ReactExoplayerView extends FrameLayout implements
setControls(controls); setControls(controls);
} }
UiThreadUtil.runOnUiThread(() -> { UiThreadUtil.runOnUiThread(() -> {
WindowCompat.setDecorFitsSystemWindows(window, true); WindowCompat.setDecorFitsSystemWindows(window, originalFitsSystemWindows);
controller.show(WindowInsetsCompat.Type.systemBars()); controller.show(WindowInsetsCompat.Type.systemBars());
eventEmitter.onVideoFullscreenPlayerDidDismiss.invoke(); eventEmitter.onVideoFullscreenPlayerDidDismiss.invoke();
}); });