handle configuration changes right on start

This commit is contained in:
Boulay Mathias 2022-06-01 08:41:54 +02:00 committed by GitHub
parent c1212c7039
commit 70b3c5597a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -600,9 +600,15 @@ public class MinecraftGLSurface extends View {
windowWidth = Tools.getDisplayFriendlyRes(Tools.currentDisplayMetrics.widthPixels, mScaleFactor);
windowHeight = Tools.getDisplayFriendlyRes(Tools.currentDisplayMetrics.heightPixels, mScaleFactor);
if(LauncherPreferences.PREF_USE_ALTERNATE_SURFACE){
((SurfaceView)mSurface).getHolder().setFixedSize(windowWidth, windowHeight);
SurfaceView view = (SurfaceView) mSurface;
if(view.getHolder() != null){
view.getHolder().setFixedSize(windowWidth, windowHeight);
}
}else{
((TextureView)mSurface).getSurfaceTexture().setDefaultBufferSize(windowWidth, windowHeight);
TextureView view = (TextureView)mSurface;
if(view.getSurfaceTexture() != null){
view.setDefaultBufferSize(windowWidth, windowHeight);
}
}
CallbackBridge.sendUpdateWindowSize(windowWidth, windowHeight);