fix(android): re-layout controls after fullscreen dismiss (#3490)

* fix(android): re-layout controls after fullscreen dismiss
This commit is contained in:
Krzysztof Moch 2024-01-26 21:34:07 +01:00 committed by GitHub
parent e63c7cbd30
commit 135d97ce50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -387,7 +387,7 @@ public class ReactExoplayerView extends FrameLayout implements
*/ */
private void togglePlayerControlVisibility() { private void togglePlayerControlVisibility() {
if (player == null) return; if (player == null) return;
reLayout(playerControlView); reLayoutControls();
if (playerControlView.isVisible()) { if (playerControlView.isVisible()) {
playerControlView.hide(); playerControlView.hide();
} else { } else {
@ -500,6 +500,11 @@ public class ReactExoplayerView extends FrameLayout implements
view.layout(view.getLeft(), view.getTop(), view.getMeasuredWidth(), view.getMeasuredHeight()); view.layout(view.getLeft(), view.getTop(), view.getMeasuredWidth(), view.getMeasuredHeight());
} }
private void reLayoutControls() {
reLayout(exoPlayerView);
reLayout(playerControlView);
}
private class RNVLoadControl extends DefaultLoadControl { private class RNVLoadControl extends DefaultLoadControl {
private final int availableHeapInBytes; private final int availableHeapInBytes;
private final Runtime runtime; private final Runtime runtime;
@ -725,7 +730,8 @@ public class ReactExoplayerView extends FrameLayout implements
player.prepare(); player.prepare();
playerNeedsSource = false; playerNeedsSource = false;
reLayout(exoPlayerView); reLayoutControls();
eventEmitter.loadStart(); eventEmitter.loadStart();
loadVideoStarted = true; loadVideoStarted = true;
@ -1992,7 +1998,7 @@ public class ReactExoplayerView extends FrameLayout implements
eventEmitter.fullscreenWillDismiss(); eventEmitter.fullscreenWillDismiss();
if (controls && fullScreenPlayerView != null) { if (controls && fullScreenPlayerView != null) {
fullScreenPlayerView.dismiss(); fullScreenPlayerView.dismiss();
reLayout(exoPlayerView); reLayoutControls();
} }
UiThreadUtil.runOnUiThread(() -> { UiThreadUtil.runOnUiThread(() -> {
WindowCompat.setDecorFitsSystemWindows(window, true); WindowCompat.setDecorFitsSystemWindows(window, true);